The mysql log reports an error:
2022-02-22T03:21:39.505055Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2022-02-22T03:21:39.505065Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
problem causes:
The number of files that the user needs to open exceeds the upper limit, which can be viewed through the command “ulimit -a”
Solution:
ulimit -n 65535
The ulimit command is used to limit system users’ access to shell resources, but it only takes effect temporarily. To take effect permanently, you need to configure the /etc/security/limits.conf file. The syntax and common configurations are as follows:
vi /etc/security/limits.conf # The linux resource limit configuration file is /etc/security/limits.conf; limiting the number of user processes is very important for the stability of the linux system. The limits.conf file limits the maximum number of files a user can use, maximum threads, maximum memory and other resource usage.
Add the following two lines to set
mysql hard nofile 65535
mysql soft nofile 65535 #The maximum number of file descriptors a mysql user can open is 1024 by default, the value here will limit tcp connections. soft is a warning value, while hard is a real threshold value, exceeding it will result in an error.
vi /usr/lib/systemd/system/mysqld.service Add the following line
LimitNOFILE=65535
# systemctl daemon-reload
# systemctl restart mysql.service
Similar Posts:
- [Solved] Linux Start solr Error: Your Max Processes Limit is currently 31202. It should be set to 65000 to avoid operational disruption.
- Nginx report 500 internal server error
- [Solved] Elasticsearch Startup Error: node validation exception
- [Solved] Linux Start solr Server Error: Your open file limit is currently 1024
- OSError: [Errno 24] Too many open files [How to Solve]
- Error: too many open files [How to Solve]
- [Solved] Mariadb Start Error: Could not increase number of max_open_files to more than 1024 (request: 5035)
- [Solved] JVM Error: Failed to write core dump. Core dumps have been disabled.(jar was Forced to Exit)
- su: cannot set user id: Resource temporarily unavailable
- Nginx Error: too many open files [How to Solve]