172.17.16.182是主库
配置文件:
vi /etc/my.cnf
..
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
basedir = /usr
datadir = /data2/mysql
user = mysql
slave_load_tmpdir = /data2/mysql_tmpdir
tmpdir = /data2/mysql_tmpdir
..
server-id = 17182
..
log-bin=/data2/mysql/mysql-bin
..
保存退出
#service mysql restart
#mysql -p
(user:root time: 17:23)[db: (none)]grant replication slave on *.* to yiqifa_bs_88@'172.16.17.1 //对从库授权
Query OK, 0 rows affected (0.04 sec)
172.17.16.184从库
修改配置文件:
#vi /etc/my.cnf
..
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
basedir = /usr
datadir = /data/mysql
user = mysql
slave_load_tmpdir = /data/mysql_tmpdir
tmpdir = /data/mysql_tmpdir
replicate-do-db =yumo //指定同步的库名
..
保存退出
#service mysql restart
#mysql -p
(user:root time: 17:27)[db: (none)]change master to master_host='172.16.17.182',master_user='yiqifa_bs_88',master_password='yiqifa_bs_88',master_log_file='mysql-bin.000003',master_log_pos=107;
Query OK, 0 rows affected (0.10 sec)
(user:root time: 17:27)[db: (none)]start slave;
(user:root time: 17:27)[db: (none)]show slave status\G;
阅读(1221) | 评论(0) | 转发(0) |