MySQL - max_connections


Andy

Administrator
Staff member
To view the max_connections use phpMyAdmin.

1. From cPanel select the phpMyAdmin program.
2. Select the database.
3. Click the SQL tab.
4. Enter the following:

show variables like "max_connections"

The default is 151 and you should see this:

1587612474845.png
 

AppleMango

New Member
That value will only last until next time the database is restarted, though.

For the change to last, you have to either set the variable in:
  1. A MySQL/MariaDB/Percona option file (typically /etc/my.cnf or any file included from that file - and make sure to put it in the right section - the [mysqld] section should work), or ...
  2. If you're using MySQL 8.0 there is a way to set the variable permanently from the command-line or phpMyAdmin:

SET PERSIST max_connections = 200;
 

Andy

Administrator
Staff member
On very busy forums where you will have more than 1000 guests, the max_connections should be increased, for example set to 300.
 

Andy

Administrator
Staff member
To make the change permanent you need to edit the my.cnf configuration file. On CentOS, RedHat and similar distributions this is at /etc/my.cnf; other distros will store it elsewhere.

max_connections=200

Now when you restart MySQL the next time it will use this setting instead of the default.

Note that increasing the number of connections that can be made will increase the potential amount of RAM required for MySQL to run. Increase the max_connections setting with caution!
 

Andy

Administrator
Staff member
On a VPS server you will need to contact the web host and ask them to do it. The default is max_connections=50 so you can ask the web host to set it to max_connections=75 and hopefully that will be enough.
 
Similar threads
Thread starter Title Forum Replies Date
Andy MySQL tuner Server Information 2
Andy Show MySQL variables Server Information 2
Andy MySQL queries General 1
Andy Max Image settting in config.php XenForo configuration 2

Similar threads

Top