标签:
环境:CentOS6.3 数据库mysql6.5.26
编辑/etc/my.cnf
vi /etc/my.cnf
重启mysql
service mysqld restart
create user ‘mastj‘@‘192.168.1.16‘ identified by ‘123456‘;
grant replication slave on *.* to ‘mastj‘@‘118.123.199.12‘ identified by ‘123456‘;
show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 585 | | mysql | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
记住mysql-bin.000001 和585两个参数,这个将在从服务器设置。
主数据库配置完成
从服务器配置
vi /etc/my.cnf
只需要在[mysqld]
下面加一条server-id=2即可
然后重启mysql服务
service mysqld restart
标签:
原文地址:http://www.cnblogs.com/mergn/p/4800729.html