>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 ),可以看到: