设置 MySQL 复制?
更新:已编辑以将实际数据添加到数据库中,但仍然存在同样的问题。
我正在使用 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
都是空的。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后想通了。
线索在MySQL手册中,其中它说:
我正在使用同一个会话:)
Figured it out in the end.
The clue is in the MySQL manual, where it says:
I was using the same session :)