【发布时间】:2011-05-05 14:28:12
【问题描述】:
更新:已编辑以将实际数据添加到数据库,但仍然是同样的问题。
我正在使用 Debian (6.0.1) 的香草安装、最新版本的 MySQL,并尝试设置 MySQL 数据库复制。
这是我到目前为止所做的:
$ apt-get upgrade
$ apt-get install mysql-client mysql-server
$ vi /etc/mysql/my.cnf
# Comment out bind-addressb
# bind-address = 127.0.0.1
# Add these lines
log-bin = /var/log/mysql/mysql-bin.log
binlog-do-db=exampledb
server-id=1
$ /etc/init.d/mysql restart
$ mysql -u root -p
> CREATE DATABASE exampledb;
> USE exampledb;
> CREATE TABLE berries (name VARCHAR(100));
> INSERT INTO berries VALUES ('cherry');
> INSERT INTO berries VALUES ('bilberry');
> exit;
$ /etc/init.d/mysql restart
$ mysql -u root -p
> GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '<some_password>';
> FLUSH PRIVILEGES;
> USE exampledb;
> INSERT INTO berries VALUES ('blackberry');
> FLUSH TABLES WITH READ LOCK;
> SHOW MASTER STATUS;
此时,显然我应该看到日志文件的一些详细信息,但我看到的是:
Empty set (0.00 sec)
有什么想法吗? /var/log/mysql.err 和 /var/log/mysql.log 都是空的,即使在再次重新启动后也是如此。
谢谢!
【问题讨论】:
-
你不需要在这个数据库上做一些事情,然后它就会显示状态吗?如果我没记错的话,在操作发生之前二进制日志中不会有任何内容。
-
您是否在创建数据库后再次尝试重新启动 MySQL?在尝试查看状态之前,您还应该尝试创建一个表并在其中插入一些测试值。如果您正在关注 howtoforge 教程,请注意这一点:
Both systems have MySQL installed, and the database exampledb with tables and data is already existing on the master, but not on the slave. -
谢谢。我已经尝试过这样做 - 并相应地编辑了问题 - 但我仍然看到“空集”,并且日志文件仍然是空的 :(
标签: mysql database replication