标签:bin char drop default log-bin csharp -- serve color
1.master配置
server-id=1 log-bin=mysql-bin binlog-do-db=testdata binlog-ignore-db=mysql
2.master增加用户
grant replication slave on *.* to ‘test‘ @‘192.168.176.%‘ identified by ‘123456‘;
3.从数据库检测是否可以远程连接主数据库
笔记:防火墙3306端口开通 iptables -I INPUT -s 0/0 -p tcp --dport 3306 -j ACCEPT 查看iptables -L -n|grep 3306
4.从数据库配置
server-id=2 expire_logs_days=10 max_binlog_size=100M relay-log=slave-relay-bin relay-log-index=salve-relay-bin.index
5.登录从数据库
1.reset slave;
2.change master to master_host=‘192.168.176.3‘,master_port=3306,master_user=‘test‘,master_password=‘123456‘,master_log_file=‘mysql-bin.000003‘,master_log_pos=120;
,master_log_file与master_log_pos 在主数据库 show master status;中查看
3.start slave;
笔记,不同数据库复制库表 :mysqldump testdata -uroot -proot --add-drop-table | mysql -h 192.168.176.4 testdata -u root -proot
前提,1.目标数据库建好库 CREATE DATABASE `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
2.授权远程连接GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";
mysql重启 service mysqld restart 配置文件 :/etc/my.cnf
标签:bin char drop default log-bin csharp -- serve color
原文地址:http://www.cnblogs.com/gaoyawei/p/7860486.html