mariadb configuration slow sql query

Mariadb and Mysql configurations are the same

What is configured here is that mariadb
modifies the configuration file.

vi /etc/my.cnf.d/server.cnf
[mysqld]
slow_query_log=on
slow_query_log_file=/data/mysql_data/slow_query_log.log
long_query_time=2
  • slow_query_log=on turns on slow sql query
  • slow_query_log_file=/data/mysql_data/slow_query_log.log slow sql storage path
  • long_query_time=2 sql is OK. If it exceeds 2 seconds, it will be recorded in the slow sql log and can be adjusted.

Create slow sql log file

mkdir -p /data/mysql_data
touch /data/mysql_data/slow_query_log.log
chown mysql:mysql /data/mysql_data/slow_query_log.log

Restart mariadb

systemctl restart mariadb

View log

cat  /data/mysql_data/slow_query_log.log

Insert image description here

Supongo que te gusta

Origin blog.csdn.net/qq_50247813/article/details/135407890
Recomendado
Clasificación