login.sh
成都创新互联公司2013年开创至今,先为利川等服务建站,利川等地企业,进行企业商务咨询服务。为利川企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
#!/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;
新闻标题:mysql学习笔记之主从复制Replication-创新互联
链接URL:http://jkwzsj.com/article/cdihsc.html