Change MySQL max_connections & Restart

To make the changes to the maximum connection count in MySQL take effect, the MySQL service needs to be restarted.

First, log in to the MySQL server with administrative privileges. Next, follow these steps:

  1. The directory /etc
  2. The MySQL configuration directory at /etc/mysql.
  3. mySQL demon
  4. – MySQL database instance
  5. max_connections=
  6. New maximum number of connections
  7. Save and close the configuration file.
  8. In systems managed by systemd, you can restart mysql with the command: sudo systemctl restart mysql.
  9. In systems managed by sysvinit: execute “sudo service mysql restart”

After completing the above steps, the maximum connection number of MySQL will be modified and take effect immediately. You can verify if the maximum connection number has been modified by executing the following SQL statement.

SHOW VARIABLES LIKE 'max_connections';

This statement will display the current maximum connection setting for MySQL.

bannerAds