UPDATE: have edited to add actual data to the database, but still the same problem.
I'm working with a vanilla install of Debian (6.0.1), up-to-date versions of MySQL, and trying to set up MySQL database replication.
This is what I've done so far:
$ 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;
At this point, apparently I should see some details of the log file, but what I'm seeing instead is:
Empty set (0.00 sec)
Any ideas? /var/log/mysql.err
and /var/log/mysql.log
are both empty, even after another restart.
Thanks!
Figured it out in the end.
The clue is in the MySQL manual, where it says:
In a different session on the master, use the SHOW MASTER STATUS statement
I was using the same session :)
精彩评论