Increase MySQL Maximum No Connection in CentOS VPS

In you have rather busy VPS, the default MYSQL Maximum No Connection maybe not sufficient. To increase follow the steps below.

1. SSH to your VPS

2. Check the current maximum no connection limit

echo "show variables like 'max_connections';" | mysql

3. Edit my MySQL file. Remember to backup your /etc/my.cnf prior to that.

vi /etc/my.cnf

4. Add or edit connection limit in the MySQL configuration file

max_connections = 250

5. Save MySQL configuration file

6. Restart mySQL

service mysql restart

7. Confirm the new maximum no connection limit

echo "show variables like 'max_connections';" | mysql

1 comment… add one
  • I would like to increase max_connections on my CentOS 7 VPS and tried to follow the steps mentioned, but I don’t get the same output. What is going wrong?

    [[email protected] ~]# echo “show variables like ‘max_connections’;” | mysql
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
    [[email protected] ~]# vi /etc/my.cnf
    # use it for options that affect everything

    # include all files from the config directory
    !includedir /etc/my.cnf.d

    “/etc/my.cnf” 13L, 292C


Leave a Comment