1. Configure using CLI. For testing . long_query_time using 0.0000000001 from default 10
direct command in mysql
MariaDB [(none)]> set global slow_query_log = 'ON'
MariaDB [(none)]> set global log_queries_not_using_indexes = 'ON';
MariaDB [(none)]> set global slow_query_log_file = 'teguh-slow.log';
MariaDB [(none)]> set global long_query_time = 0.000000000001;
MariaDB [(none)]> show variables like '%slow%';
MariaDB [(none)]> show variables like '%long%';
2. Or Configure using server.cnf or my.cnf to get data persistent. For testing. long_query_time using 0.000000000001 from default 10
[root@teguhth ~]# cat /etc/my.cnf.d/server.cnf
#.............
slow_query_log = 1
log_queries_not_using_indexes = 'ON'
slow_query_log_file = /var/lib/mysql/teguh-slow.log
long_query_time = 0.0000000001
#.............
[root@teguhth ~]#
3. Check configuration
MariaDB [(none)]> show variables like '%slow%';
MariaDB [(none)]> show variables like '%long%';
4. Check slow log server with run some query
[root@teguhth mysql]# tail -f /var/lib/mysql/teguh-slow.log
No comments:
Post a Comment