mysql>create user zbdba;
mysql>grant replication slave on *.* to zbdba identified by '123456';
3、 复制Master上的数据库到Slave
mysql>flush tables with read lock;
mysql> show master status
-> ;
+-----------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------+----------+--------------+------------------+
| ogg1-bin.000003 | 107 | | |
+-----------------+----------+--------------+------------------+1 row in set (0.00 sec)
mysql>quit
[iyunv@ogg /]# /usr/bin/mysqldump zbdba -uroot -pmysql --opt | mysql zbdba -uroot -pmysql -h 192.168.56.13
需要在slave中授权:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.56.13' IDENTIFIED BY 'mysql' WITH GRANT OPTION;
ERROR 1130 (HY000): Host '*.*.*.*' is not allowed to connect to this MySQL server
解决方法:
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;