Mysql主从复制

master服务器设置

1.安装mysql并启动

yum -y install mysql-server mysql

2.启动mysql服务

systemctl enable mysqld;systemctl start mysqld

3.修改root密码

alter user 'root'@'localhost' identified by '989891';

4.关闭防火墙

# systemctl disable firewalld
# sed -i -r '/SELINUX=/c\SELINUX=disabled' /etc/selinux/config

5.修改配置文件

echo "server-id=1"  >> /etc/my.cnf.d/mysql-server.cnf 

6.创建slave连接master的账号

mysql> create user slave identified by "98989";

mysql> grant replication slave on *.* to slave;
mysql> flush privileges;

slave服务器设置

1~4同master配置

5.修改配置文件

echo "server-id=2"  >> /etc/my.cnf.d/mysql-server.cnf 

6.设置slave同步

mysql> stop slave;
mysql> change master to master_host='192.168.98.201',master_user='slave',master_password='98989',master_log_file='binlog.000002';
mysql> start slave;

7.验证是否通讯

 show slave status \G;

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇