MySQL Notes < memos >

Source: Internet
Author: User
Tags compact log log

MySQL Common tools:


1. mysql

-E EXECUTE statement

-e equivalent to \g;

-S strip Box


2, Mysqldump

MYSQLDUMP-UROOT-P--COMPACT-C database_name [table_name]-t >./

-T means that two files (. sql and. txt) are generated at the time of the backup, and the execution statements are stored in the. sql file, and the true content is stored in a. txt file.

-F Flush Log

-L Lock all tables for read.

-R saved to the specified file

--compact Simplicity

-C causes the fields to be displayed in the INSERT statement

3. Mysqlimport Import the contents of the TXT file backed up by mysqldump-t

mysqlimport-uroot-p-l database_name txt_filename

-L,--local Read All files through the client.


4, Mysqlbinlog

Mysqlbinlog binlog_filename-d mysql-s--start-datetime= ' 2015/08/08 00:00:00 '--stop-datetime= ' 2015/08/08 01:00:00 '

Read log in Binglog_filename,-D Specify database,-s concise, short format

5, Mysqlshow

List databases by default

--count displaying statistics for databases and tables

After the database name is added directly, specify which database to count

6. Perror Error Code viewing tool

Directly followed by the error number

Mysql Bin-log log:

Add a configuration entry in the Master profile: Log-bin[=file_name] If file_name is not specified, the default name is the hostname followed by-bin, if file_name is specified, but no path is included, The file is written by default to the directory specified by the DataDir (data directory).

To delete a log:

A. Perform "RESET MASTER;" command, the command deletes all Binlog logs, starting with the new log number from "000001".

B, execute "PURGE MASTER LOGS to ' mysql-bin.****** '" command, which will delete all logs before the "******" number.

C, execute "PURGE MASTER LOGS before ' yyyy-mm-dd hh24:mi:ss '" command, which will delete all logs generated before the date "Yyyy-mm-dd hh24:mi:ss".

D. In the main profile [mysqld], add "expire_log_day=3", this parameter is the number of days to set the log expiration.


7. Slow query Log

Slow_query_log[=1] Open the slow query log

Slow_query_log_file Log Path

Long_query_time defines a query that exceeds a specified time will be logged

Use "Mysqldumpslow slow_log_file" to view slow query log files


MySQL Notes < memos >

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.