MySQL Service log vs. backup command

Source: Internet
Author: User

Mysqlbinlog:

Used to parse Binlog logs. Under the data directory, Mysql.index is the index file for Mysqlbinlog. The role of Binlog is to record internal MySQL deletions. Do not record select.

Options:

1.-d dbname: For the library, split the binary log of the specified library

2.--start-position;--stop-position mysqldump mysql-bin.000006--start-position=486--stop-position=1156 > Test.sql


Master-data=

When it is 2 o'clock, the Master_log_pos line will be commented out, and when it is 1 o'clock, the Master_log_pos line will not be commented.


is equal to 1 of the role, when the master from the synchronization, using--master-data=1,master_log_pos that line is not annotated, will be fully poured into the execution from the library, Master_log_pos will tell you where to start the recovery from the main library.


Log files in the MySQL database


Error log: Logs the error log that the MySQL service process mysqld encountered during startup and shutdown or running

Query log:

Normal query log: Log client connection information and execute SQL statement information

Slow query logs (slow query log): Records an SQL statement that executes longer than the specified value, or an SQL statement that does not have an index (optimized slow query SQL statement is DBA)

Binary logs (binary log): Records information about the data being modified:


Error log: Ending with err in the data directory

Binary log: Bin-log


Normal query log and slow query log generally do not open, log file is too large

For normal logs:

Mysql> Show variables like '%log% ';

Use set to open it:

mysql> Set Global general_log = on; Query OK, 0 rows affected (0.01 sec)

And then randomly create or query several tables, which are recorded in the Localhost.log file.


Slow query: (in/ETC/MY.CNF configuration)

  1. #查询时间超过1秒的sql语句会被记录

  2. Long_query_time=1

  3. #记录没有使用索引的查询

  4. Log_queries_not_using_indexes=1

  5. #记录慢查询日志的文件地址

  6. Slow-query-log-file=/usr/local/mysql/localhost-slow.log

There are 3 modes of Binlog logs.




MySQL Service log vs. backup command

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.