Master# pwd /var/eyou/mysql/bin Master#./mysql –u root –p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT FILE ON *.* TO rep@192.168.0.244 IDENTIFIED BY ‘eyou’;
mysql> GRANT REPLICATION SLAVE ON *.* TO rep@192.168.0.244 IDENTIFIED BY ‘eyou’;
7、测试 先检测两个Mysql数据库中的reptest是否正常。 正常情况应该是Master和Slave 中的Mysql 都有相同的reptest 数据库,并且里面的数据都一样。 然后测试replication 功能是否起用。 在Master中的reptest数据库添加一笔数据: Master# /var/eyou/mysql/bin/mysql –u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
3,在show master status 或着show slave status 不正常时,看看.err是怎样说的。 4,Slave上Mysql的Replication工作有两个线程, I/O thread和SQL thread 。I/O 的作用是从master 3306端口上把它的binlog取过来(master在被修改了任何内容之后,就会把修改了什么写到自己的binlog等待slave更新),然后写到本地的relay-log,而SQL thread则是去读本地的relay-log,再把它转换成本Mysql所能理解的语句,于是同步就这样一步一步的完成.决定I/O thread的是/var/lib/mysql/master.info,而决定SQL thread的是/var/lib/mysql/relay-log.info.
双向复制模式
1:
Slave 机器设置权限,赋予Master机器FILE及Replication Slave权利.
Master#./var/eyou/mysql –u root –p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT FILE ON *.* TO rep@192.168.0.217 IDENTIFIED BY ‘eyou’;
mysql> GRANT REPLICATION SLAVE ON *.* TO rep@192.168.0.217 IDENTIFIED BY ‘eyou’;