主从版本一致
master端
[root@puppetmaster ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin = mysql-bin
server-id=1
# Default to using old password format for compatibility with mysql3.x
# clients (those using the mysqlclient10 compatibilitypackage).
old_passwords=1
# Disabling symbolic-links is recommended to prevent assortedsecurity risks;
# to do so, uncomment this line:
# symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
授权(在主服务器上进行)
mysql>flush privileges;
mysql>flush tables with read lock;
将从库的database导入 mysql -u root -p dashboard </home/dashboard.sql(必须有dashboard库 如没有则创建 created databasedashboard;)
主库 mysql 解锁
mysql>unlock tables;
mysql> show master status;
+------------------+----------+--------------+------------------+
|File
+------------------+----------+--------------+------------------+
| mysql-bin.000002|
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
配置从服务器
从服务器上my.cnf
也启动二进制日志
[root@logserver-SW ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server-id = 2
# Default to using old password format for compatibility with mysql3.x
# clients (those using the mysqlclient10 compatibilitypackage).
old_passwords=1
# Disabling symbolic-links is recommended to prevent assortedsecurity risks;
# to do so, uncomment this line:
# symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
正确执行后再执行:
mysql> show slave status\G
mysql> show slave status\G;
*************************** 1. row***************************
Replicate_Wild_Ignore_Table: