56,681
社区成员
发帖
与我相关
我的任务
分享
1、show binlog events 命令不是在SHELL下执行的,是在MYSQL的SHEll中执行的。
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 214
Server version: 5.1.21-beta MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show binlog events\G
Empty set (0.00 sec)
这个是没有开启BINLOG前的。
开启步骤见下面:
开启后的是这样的:
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.21-beta-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show binlog events\G
*************************** 1. row ***************************
Log_name: localhost-bin.000001
Pos: 4
Event_type: Format_desc
Server_id: 1
End_log_pos: 106
Info: Server ver: 5.1.21-beta-log, Binlog ver: 4
1 row in set (0.00 sec)
mysql>
2、BINLOG的开启:
[root@localhost ~]# vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/
port=3306
user=nobody
socket=/tmp/mysql.sock
default-character-set=utf8
log-bin这里就可以了。
"/etc/my.cnf" 36L, 558C written
[root@localhost ~]# service mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!