debian mysql 主从复制
2012-05-07 18:59
375 查看
主
安装数据库
主IP 192.168.0.59
辅助:IP 192.168.0.60
apt-get install mysql-server mysql-client
修改my.cnf见附件
1.mysql_install_db --user=mysql --datadir=/home/data/db/mysql
2.cat /etc/mysql/debian.cnf |grep password |head -n 1|awk '{print $3}'
oaoUdbzsGY0f4cgO
3.登入mysql执行
>GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'oaoUdbzsGY0f4cgO';
use mysql
update user set Password = password('oaoUdbzsGY0f4cgO') where User='debian-sys-maint';
FLUSH PRIVILEGES;
初始化完毕
mysql>
grant replication slave on *.* to 'repl_user'@'192.168.0.60' identified by 'repl_123';
show master status;
mysql> show master status;
+------------------+----------+--------------+--------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+--------------------------+
| mysql-bin.000003 | 193 | | mysql,information_schema |
+------------------+----------+--------------+--------------------------+
1 row in set (0.00 sec)
辅助:安装数据库已经初始化数据库同上
修改my.cnf见附件
mysql>
change master to master_host=192.168.0.59',master_user='repl_user',master_password='repl_123',master_port=3306,master_log_file='mysql-bin.000003',master_log_pos=193;
slave start;
show slave status\G
附件:http://down.51cto.com/data/2360508
安装数据库
主IP 192.168.0.59
辅助:IP 192.168.0.60
apt-get install mysql-server mysql-client
修改my.cnf见附件
1.mysql_install_db --user=mysql --datadir=/home/data/db/mysql
2.cat /etc/mysql/debian.cnf |grep password |head -n 1|awk '{print $3}'
oaoUdbzsGY0f4cgO
3.登入mysql执行
>GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'oaoUdbzsGY0f4cgO';
use mysql
update user set Password = password('oaoUdbzsGY0f4cgO') where User='debian-sys-maint';
FLUSH PRIVILEGES;
初始化完毕
mysql>
grant replication slave on *.* to 'repl_user'@'192.168.0.60' identified by 'repl_123';
show master status;
mysql> show master status;
+------------------+----------+--------------+--------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+--------------------------+
| mysql-bin.000003 | 193 | | mysql,information_schema |
+------------------+----------+--------------+--------------------------+
1 row in set (0.00 sec)
辅助:安装数据库已经初始化数据库同上
修改my.cnf见附件
mysql>
change master to master_host=192.168.0.59',master_user='repl_user',master_password='repl_123',master_port=3306,master_log_file='mysql-bin.000003',master_log_pos=193;
slave start;
show slave status\G
附件:http://down.51cto.com/data/2360508
相关文章推荐
- MySQL主从同步复制 for Debian OS
- MySQL主从复制
- Mysql之主从复制原理
- mysql主从复制详解
- mysql主从复制简单实现
- MySQL主从,双主,半同步及SSL复制 推荐
- centos6中的mysql主从复制
- MySQL 5.6 主从复制配置
- mysql主从复制环境搭建
- mysql5.5主从同步复制配置
- mysql主从复制脱坑
- MySQL之——MS主从复制(读写分离)实现
- mysql之主从复制篇
- 浅谈mysql主从复制的高可用解决方案
- Mysql HA 之主从复制
- MYSQL实现主从复制的日志是哪种?
- Mysql的主从复制的读写分离之Amoeba实现 推荐
- Mysql主从复制
- MySQL主从复制与读写分离
- mysql(mariadb)基于ssl主从复制