您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
login.sh
#!/bin/bash
mysql -h227.0.0.1 -uroot -P3306 -p'Yxc@3306'
start.sh
#!/bin/bash
mysqld_safe --defaults-file=/data/mysql/3306/my3306.cnf --user=mysql &
shutdown.sh
#!/bin/bash
/usr/local/mysql/bin/mysqladmin -uroot -P3306 -p'Yxc@3306' -S /data/mysql/3306/mysql3306.sock shutdown
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql/3306/data
port=3306
socket=/data/mysql/3306/mysql3306.sock
character-set-server=utf8
log-error=/data/mysql/3306/log/error3306.log
pid-file=/data/mysql/3306/mysqld3306.pid
log_bin=mysql_bin
binlog-format=Row
server-id=51
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql/3306/data
port=3306
socket=/data/mysql/3306/mysql3306.sock
character-set-server=utf8
log-error=/data/mysql/3306/log/error3306.log
pid-file=/data/mysql/3306/mysqld3306.pid
log-bin=mysql_bin
server-id=52
relay-log-index=slave-relay-bin.index
relay-log=slave-relay-bin
create user 'repl'@'%' identified by 'repl'; grant replication slave on *.* to 'repl'@'%';
主库上执行命令,获取当前binlog日志及位置
show master status;
获取file,position信息,在两个从库上分别执行如下脚本
CHANGE MASTER TO
MASTER_HOST='192.168.56.5',
MASTER_PORT=3306,
MASTER_USER='repl',
MASTER_PASSWORD='repl',
MASTER_LOG_FILE='mysql_bin.000002',
MASTER_LOG_POS=154;
从库上,启动复制,并查看复制状态
start slave;
show slave status;
^说明: 如出现如图字样,表示成功。关于slave的命令,可以通过help slave;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。