MySQL DBA system Learning (5) One of the binary logs

Source: Internet
Author: User
Tags dba log log log variables mysql database

One, the function of binary log files

MySQL binary log records are all the changes in the MySQL database information, so very important to the database, the role of binary log I summed up the main include the following aspects:

1, can be used for the database based on Point-in-time restore.

2, can be used to analyze changes in the database, such as the bug caused the database data changes and so on.

3, the binary log can also be used to rebuild the database.

Two, binary log-related variables and parameters

Third, configure the binary log

1, open Bin-log log, modify in MY.CNF

Specify the path to the Bin-log log, open the log after the need for Myssqladmin flush log to take effect, after the reboot we found in the path just set up the log file, which is the binary log we need

Log-bin=/tmp/mysql-bin

2, the MySQL service that launches binary file

[Root@test4/]# mysqld_safe--defaults-file=/etc/my.cnf--log-bin=/tmp/1.0001--log-bin-index=/tmp/logbin.index-- max-binlog-size=10m--binlog-do-db=test

3, the contents of the binary log index file

mysql> system Cat/tmp/logbin.index

/tmp/1.000001

/tmp/1.000002

Iv. managing binary Logs

1, to see if the function of the binary log file is turned on

Mysql> Show variables like "%log_bin%";

+---------------------------------+-------+

| variable_name | Value |

+---------------------------------+-------+

| Log_bin | On |

| log_bin_trust_function_creators | Off |

| log_bin_trust_routine_creators | Off |

| Sql_log_bin | On |

+---------------------------------+-------+

2, view the binary file situation

Mysql> show master logs;

+----------+-----------+

| Log_name | File_size |

+----------+-----------+

|       1.000001 | 141 |

|       1.000002 | 106 |

+----------+-----------+

2 rows in Set (0.00 sec)

Mysql> show binary logs;

+----------+-----------+

| Log_name | File_size |

+----------+-----------+

|       1.000001 | 141 |

|       1.000002 | 106 |

+----------+-----------+

2 rows in Set (0.00 sec)

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.