MySQL can log slow queries which take more time to execute. This may due to the bad coding. So, the slow query log will help you to find out the bad codes and hence you can improve the site performance.
Enable slow query log
1. Please add the following in your /etc/my.cnf file.
slow-query-log = 1 log-slow-queries=/var/lib/mysql/slow.log
2. Create the slow query log file and set the correct ownership and permissions.
touch /var/lib/mysql/slow.log chmod 660 /var/lib/mysql/slow.log chown mysql:mysql /var/lib/mysql/slow.log
3. Restart the mysql service.
/etc/init.d/mysql restart
Please wait for some time and check the slow query log file to find out the slow queries. That’s it!!
If you like the post and wish to receive more articles from us, please like our FB page: If you like this post and wish to receive more articles from us, please like our FB page: Button
Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.
For more details on our services, please drop us an E-mail at info@grepitout.com
Add Comment