设置MySQL复制?

时间:2011-05-05 14:28:13

标签: mysql database replication

更新:已编辑将实际数据添加到数据库,但仍然存在同样的问题。

我正在使用Debian(6.0.1)的vanilla安装,最新版本的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)

有什么想法吗? <{1}}和/var/log/mysql.err都是空的,即使在重新启动后也是如此。

谢谢!

1 个答案:

答案 0 :(得分:0)

最后计算出来。

线索位于MySQL manual,其中包含:

In a different session on the master, use the SHOW MASTER STATUS statement

我正在使用相同的会话:)

相关问题