码迷,mamicode.com
首页 > 数据库 > 详细

mariadb主从

时间:2020-03-20 17:16:34      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:orm   mat   sele   rom   _id   ant   creat   mysql   color   

vim /etc/my.cnf +10

i

log-bin=mysql-bin

binlog-ignore-db=information_schema

binlog-ignore-db=mysql

binlog-ignore-db=performance_schema

server-id= 1

 

 

vim /etc/my.cnf +10

i

server-id=2

read_only = 1

 

 

 

systemctl restart mariadb

 

主库

mysql -p123qwe

 

 

CREATE USER ‘abc‘@‘%‘ IDENTIFIED BY ‘123qwe‘;

grant replication slave on *.* to ‘abc‘@‘172.16.0.227‘ identified by ‘123qwe‘;

flush privileges;

show master status;

 

MariaDB [(none)]> show master status;                                      

+------------------+----------+--------------+---------------------------------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB                            |

+------------------+----------+--------------+---------------------------------------------+

| testsql.000001 |      5416 |              | information_schema,mysql,performance_schema |

+------------------+----------+--------------+---------------------------------------------+

1 row in set (0.00 sec)

 

mysql -p123qwe

 

stop slave;

CHANGE MASTER TO MASTER_HOST=‘172.16.0.226‘, MASTER_USER=‘abc‘,  MASTER_PASSWORD=‘123qwe‘, MASTER_LOG_FILE=‘testsql.000001‘, MASTER_LOG_POS=5416;

start slave;        

show slave status\G;

 

select host,user from mysql.user;   

delete from mysql.user where user=‘repl‘;

show master status;

show variables like ‘server_id‘;

 

mariadb主从

标签:orm   mat   sele   rom   _id   ant   creat   mysql   color   

原文地址:https://www.cnblogs.com/Leaders543/p/12532628.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!