mysql创建用户与授权

实验1:
第一步:在第一个主服务器上改配置文件vim /etc/my.cnf在mysql下加入这几行
[mysqld]
innodb_file_per_table
log-bin
server_id=1
auto_increment_offset=1
auto_increment_increment=2
第二步:创建账号并授权
grant replication slave on *.* to repluser@'%' identified by 'centos';
第三步:在mysql服务器上输入命令
CHANGE MASTER TO MASTER_HOST='%',MASTER_USER='repluser',MASTER_PASSWORD='centos',MASTER_LOG_FILE=mariadb-bin.000001,MASTER_LOG_POS=522555;
第四步:在第二个服务器上改配置文件vim /etc/my.cnf在mysql下加入这几行
[mysqld]
log-bin
innodb_file_per_table
server_id=2
auto_increment_offset=2
auto_increment_increment=2
第五步:systemctl start mariadb
mysql < /app/all.sql
第六步:在mysql数据库中:
show master logs;
grant replication slave on *.* to repluser@'%' identified by 'centos';
CHANGE MASTER TO MASTER_HOST='%',MASTER_USER='repluser',MASTER_PASSWORD='centos',MASTER_LOG_FILE=mariadb-bin.000002,MASTER_LOG_POS=245;
 
 
原文地址:https://www.cnblogs.com/momenglin/p/10464987.html