MySQL Restart slow query log

Source: Internet
Author: User

[Warning] '--log_slow_queries ' is deprecated and would be removed in a future release. Please use '--slow_query_log '/'--slow_query_log_file ' instead.


1. Modify the configuration file

[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
User=mysql
Slow_query_log #注意后面没有 "=on"
Slow_query_log_file=/var/lib/mysql/mysqld-slow.log #指定日志文件存放位置, default is/var/run/mysqld/mysqld-slow.log



2. When the service starts, modify the global variables, you can temporarily open the slow log

Set global slow_query_log=on; #这里要加上 "=on"

Set global slow_query_log_file = '/var/lib/mysqld/mysqld-slow.log '; #注意路径要加上引号, or you'll get an error.

MySQL Restart slow query log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.