[Solved] MYSQL Error: [Warning] Changed limits: max_open_files: 1024

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:

Leave a Reply

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