Category: MySQL SQL

With CentOS 7 you need to increase file limits and file descriptors for max connections to work.

Increase Max File Limit

#Modify Following File

#Add following to file
fs.file-max = 100000

Increase Soft / Hard Limits

#Modify Following File

#Add following to file
soft nproc 65535
hard nproc 65535
soft nofile 65535
hard nofile 65535

mysql hard nofile 65535
mysql soft nofile 65535

#Commit the above settings
sysctl -p

Edit MySQL SystemD Service Limits

#Modify Following File

#Add following to file below [service

#Reload the daemon with above settings
systemctl daemon-reload

Edit MySQL Configuration file with settings required:

#Modify following file: 

#Add following information (change if required)
open_files_limit = 1024
max_connections = 1000

#Restart MySQL to commit
systemctl restart mysqld

#Log into MySQL and run show variables like "max_connections"; to check max connections is correct

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 4

No votes so far! Be the first to rate this post.