Let’s see the process of troubleshooting the performance of the MySQL database in Plesk. Allocate memory (RAM) to the MySQL server (Ensure that you have enough RAM, sometimes increasing the values may affect the server performance. Check that you have enough RAM)
- By using SSH, connect to the Plesk server.
- Now open my.cnf or my.ini file that has the MySQL configuration and the file is located at:
For CentOS/RHEL: /etc/my.cnf
For Debian/Ubuntu: /etc/mysql/my.cnf
- Add or increase the values of the following directives below the [mysqld] section.
- Save the changes and restart the MySQL service
For CentOS/RHEL: # systemctl restart mariadb
For Debian/Ubuntu: # systemctl restart mysqld
- Keep track of your CPU usage – If CPU usage starts to increase once again, then check the SQL code of a database with slow queries.
- Find queries that are running currently and taking a long time when CPU usage is high:
# pleskdb “SHOW FULL PROCESSLIST” +—–+——-+———–+——+———+——+——-+———————–+ | Id | User | Host | db | Command | Time |State | Info | +—–+——-+———–+——+———+——+——-+———————–+ | 12 | admin | localhost | psa | Sleep |6763 | | NULL | | 100 | admin | localhost | psa | Query | 0| NULL | SHOW FULL PROCESSLIST | +—–+——-+———–+——+———+——+——-+———————–+ 2 rows in set (0.00 sec)
Analyze the /var/log/mysqld.log file for any errors in MySQL. Then, check the RAM and available disk space:
# free-h # df -h
- You can identify databases that slow down MySQL performance by enabling the MySQL slow query log.
- Analyze and optimize every table in the database. For Linux use the below command:
cat /etc/psa/.psa.shadowmysqlcheck -uadmin –optimize –all-databases
Install and run the MySQL Tuner tool: mysqltuner. This tool will help to check the active MySQL server instance and suggest improvements to change the essential parameters.
Hope this helped you to increase the MySQL Database performance on Plesk. For any tech assistance click here – Get Tech Support.
Also check: 7 Ways to Optimize High-Traffic in MySQL
To get more updates you can follow us on Facebook, Twitter, LinkedIn