>GRANT FILE ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'mysql password'; >GRANT REPLICATION SLAVE ON *.* TO 'root'@'192.168.1.2' IDENTIFIED BY 'mysql password'; >FLUSH PRIVILEGES 這里使用的仍是 root 用戶作為同步的時候使用到的用戶,可以自己設定。
4、重啟mysql,登錄mysql,顯示主庫信息
mysql> show master status; mysql> show master status; +------------------+----------+--------------+----------------------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+----------------------------------+-------------------+ | mysql-bin.000004 | 28125 | ufind_db | information_schema,cluster,mysql | | +------------------+----------+--------------+----------------------------------+-------------------+ 1 row in set (0.00 sec) mysql>
[root@VM_128_194_centos bin]# service mysqld restart Shutting down MySQL... SUCCESS! Starting MySQL... ERROR! The server quit without updating PID file (/data/mysqldb/VM_128_194_centos.pid). [root@VM_128_194_centos bin]# 此時,查看數據庫的報錯信息(數據庫的目錄, /data/mysqldb/VM_128_194_centos.err ),可以看到: