October
12
tune centos7 before use mysql (mysqld: Can’t open file: ‘.session.frm’ (errno: 24) )
1. to /etc/sysctl.conf need to add
fs.file-max = 100000
2. to /etc/security/limits.conf need to add
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
3. run #sysctl -p
4. to /usr/lib/systemd/system/mariadb.service need to add
LimitNOFILE=65535
LimitNPROC=65535
under [Service] section
5. systemctl daemon-reload
6. service mariadb restart
7. test it:
for mysql su - mysql -c 'ulimit -aHS' -s '/bin/bash'
mysqladmin variables| grep open_files_limit
8. now you can update the table_open_cache and open_files_limit in my.cnf and restart mariadb again if need.