How to increase MySQL max_connections value on a Plesk windows server?

Information:

If you're managing a Plesk control panel on Windows or Linux OS and need to increase the `max_connections` value for MySQL, this guide will walk you through the process. The `max_connections` parameter determines the maximum number of concurrent connections allowed to the MySQL database server. Adjusting this value can be crucial for handling increased traffic or optimizing database performance.

Steps to increase the `max_connections` value for MySQL on Windows Server:

Step 1. Connect your server using the Remote Desktop application. Ensure you have Remote Desktop Protocol (RDP) access to your Plesk Windows server with administrator previlages. RDP allows you to access the server's graphical interface.

Step 2. Locate and open the MySQL configuration file, `my.ini`, using a text editor of your choice. The typical path is:

%plesk_dir%DatabasesMySQLmy.ini (C:\Program Files (x86)\Plesk\Databases\MySQL)

Step 3. Within the `[mysqld]` section of the `my.ini` file, add or modify the `max_connections` parameter. For example:

[mysqld]

max_connections=150

Adjust this value according to your server's requirements.

Step 4. Save the changes you made to the `my.ini` file and close the text editor.

Step 5. To activate the new `max_connections` setting, you'll need to restart the MySQL service. You can restart MySQL using the Windows Services Manager.

Here's how:

1. Press Win + R to open the "Run" dialog.

2. Type services.msc and press Enter. This will open the Services Manager.

3. Scroll down or search for "MySQL" or "MariaDB" in the list of services.

4. Right-click on the MySQL or MariaDB service and select "Restart."

5. The MySQL service will be restarted on your Windows machine.

Steps to increase the `max_connections` value for MySQL on a Linux server:

Step 1. Begin by establishing a secure SSH connection to your Plesk server. SSH (Secure Shell) provides a command-line interface for server management.

# ssh username@your_server_ip

Step 2. Open the MySQL configuration file, `my.cnf`, using your preferred text editor. Depending on your Linux distribution, the file's location may vary:

For CentOS/RHEL-based distributions:

# vi /etc/my.cnf

For Debian/Ubuntu-based distributions:

# vi /etc/mysql/my.cnf

Step 3. Within the `[mysqld]` section of the `my.cnf` file, add or modify the `max_connections` parameter according to your requirements.

[mysqld]

max_connections=150

Be cautious when setting this value, as excessively high values can strain server resources.

Step 4. After making the necessary changes, save the `my.cnf` file and close the text editor.

Step 5. To apply the new `max_connections` setting, restart the MySQL service. Use one of the following commands, depending on your distribution:

For CentOS/RHEL-based distributions:

# service mysql restart

For Debian/Ubuntu-based distributions:

# service mariadb restart

Conclusion:

By following these steps, you can effectively increase the `max_connections` value for MySQL on your Plesk Linux and Windows server, ensuring that your database can handle the required number of concurrent connections efficiently.

 


Was this answer helpful?

« Back

chat