Linux timer modify MySQL slow query log file name

Source: Internet
Author: User
Tags mysql slow query log



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

Related Article

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.