开启和查看mysql的bin-log日志

Posted 潇潇、寒

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开启和查看mysql的bin-log日志相关的知识,希望对你有一定的参考价值。

[root@VM_0_7_centos data]# vim /etc/my.cnf 
[root@VM_0_7_centos data]# vim /etc/my.cnf 
[root@VM_0_7_centos data]# /etc/init.d/mysqld restart
Shutting down MySQL.... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@VM_0_7_centos data]# grep log_bin /etc/my.cnf 
[root@VM_0_7_centos data]# grep log-bin /etc/my.cnf 
log-bin=/opt/mysql/data/mysql-bin
mysql> show variables like \'%log_bin%\';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: wordpress

+---------------------------------+---------------------------------+
| Variable_name                   | Value                           |
+---------------------------------+---------------------------------+
| log_bin                         | ON                              |
| log_bin_basename                | /opt/mysql/data/mysql-bin       |
| log_bin_index                   | /opt/mysql/data/mysql-bin.index |
| log_bin_trust_function_creators | OFF                             |
| log_bin_use_v1_row_events       | OFF                             |
| sql_log_bin                     | ON                              |
+---------------------------------+---------------------------------+
6 rows in set (0.01 sec)

  

以上是关于开启和查看mysql的bin-log日志的主要内容,如果未能解决你的问题,请参考以下文章

mysql备份与恢复

小贝_mysql主从复制作用以及案例

linux中MySQL的bin-log日志格式更改

mysql log-bin 默认是开启的吗

mysql数据库通过bin-log日志恢复数据

mysql 主从同步服务原理