Get the App
SLTechnology News&Howtos  ›  Database  › 

How to view mysql binlog

Shulou Source: shulou.com Published: 2022-06-01 03:23:53 09月21日 Update

Editor to share with you how to view mysql binlog, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

In MySQL or MariaDB, that particular event is logged whenever you make changes to the database.

For example, when you create a new table or update data on an existing table, these events are stored in mysql binlog, the binary log of the MySQL database.

Binary logs are very useful in MySQL replication, where the primary server sends data from the binary log to the remote server.

When you perform any type of restore operation in MySQL, you will also process the binary log files.

The mysqlbinlog command is used to view the contents of the binary log in a readable, user-friendly format.

So how do we get to view the mysql binlog (binary log)?

The following is to introduce the command method to get the current binary log list.

Execute the following show binary logs command from mysql, which displays all binary logs in the system.

Mysql > SHOW BINARY LOGS;+-+-+ | Log_name | File_size | +-+-+ | mysqld-bin.000001 | 15740 | mysqld-bin.000002 | 3319 |....

If binary logging is not enabled, you will see the following error message.

Mysql > SHOW BINARY LOGS;ERROR 1381 (HY000): You are not using binary logging

Where is the location of mysql binlog?

By default, the binary log files are located in the / var/lib/mysql directory, as shown below.

# ls-l / var/lib/mysql/-rw-rw----. 1 mysql mysql 15740 Aug 16 14:57 mysqld-bin.000001-rw-rw----. 1 mysql mysql 3319 Aug 16 14:57 mysqld-bin.000002.... The above is how to view all the content of mysql binlog, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Logs binaries commands data content events databases files servers articles systems services not much that is locations most cases methods display systems more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Linux Shulou Tech Info Redmi