环境: 系统:centos 4.8 (64位) yum安装的mysql数据库。 今天作mysql主从时,查看master日志时没有数据显示, mysql> show master status; Empty set (0.00 sec) mysql> 从网上搜了一下说是master数据库没有启动 最后终于弄出来了, 用yum安装的mysql数据库/etc/my.cnf文件只是知足基本要求, 如: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1
# Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: # symbolic-links=0 server-id = 130 [mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 在/etc/my.cnf文件中添加一行 log-bin=mysql-bin 而后重启mysql数据库便可; mysql> show master status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 79 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.00 sec)