Home >Database >Mysql Tutorial >How to enable slow query log in docker mysql container
docker to view the running container
docker ps##Enter the container:
docker exec -it dc8880c13fef /bin/bashEnter the username and password Log in to mysql
mysql -u root -pand then enter the password to log in 2. View slow log related informationThe slow log is turned off by default.
show variables like ‘slow%’; (or use, see other bloggers say there will be version differences, then use double percent signs: show variables like ‘%slow %’;)
set global slow_query_log = ON;was successfully turned on. You can modify the threshold for judging whether it is slow SQL. When the SQL execution exceeds the threshold, it will be recorded in the slow log log file. After modification, test select query. Here we can see that the sql is recorded in the slow log.
The above is the detailed content of How to enable slow query log in docker mysql container. For more information, please follow other related articles on the PHP Chinese website!