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.


Copyright 2021. All rights reserved.

Posted 12 October 2016 by admin in category "simple memo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.