A: Background introduction
Two: Edit modify slow query log script
Three: Join a timed task
1. If all the slow query logs are placed in a file, it is a long time to see the slow query log will be a very painful thing, so you need to split the slow query log by time.
2. Modify the contents of the MySQL server variable slow_query_log_file script
#!/bin/sh# Modify the MySQL slow query log file name so that a slow query log files are generated every day # avoid all slow query logs in a single file, causing analysis to be viewed inconvenient username=rootpassword=redhatcurrdate= ' date +%f ' mysql-u$username-p$password-e ' SET GLOBAL slow_query_log_file= '/mysql_data/slow-$CURRDATE. Log ' "
3. Add a script to a timed task to allow the script to execute at a specific time
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/1D/wKioL1WST9TBBblVAADGhaxRKoc074.jpg "title=" 1.png " alt= "Wkiol1wst9tbbblvaadghaxrkoc074.jpg"/>
This article is from the "Everyman" blog, please make sure to keep this source http://caoyt.blog.51cto.com/9978141/1669442
Linux timer modify MySQL slow query log file name