Optimizing the software on the server is essential to ensure you don’t waste resources. For example, increasing the max_connections of MySQL will make your server serve more connections/visitors and use more resources on the dedicated server or vps server. In this article, we will guide you on how to increase the max_connections value in MySQL.
firstly, login to your server and log into MySQL, if you didn’t set any root login for MySQL you can log in by using this command:
mysql
and if you have a username and password for your MySQL server then use this format
mysql -u {username} -p {password}
next, find out the current variable in your server by using this command
SHOW VARIABLES LIKE "max_connections";
then, change the current max_connections, in this example, we set the max_connections to 450
SET GLOBAL max_connections = 450;
verify the values by checking the max_connections again
show variables like "max_connections";
and the last, you can restart MySQL to take effect.
service mysqld restart
if you are using cPanel you can restart by using this command
/scripts/restartsrv_mysql --restart