MySQL主主
【摘要】 所有节点tar xf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz useradd -s /sbin/nologin mysqlmkdir /application/mysql -pvmkdir /data/mysql/data -pvecho "PATH=/application/mysql/bin:$PATH" > /etc/profil...
tar xf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
useradd -s /sbin/nologin mysql
mkdir /application/mysql -pv
mkdir /data/mysql/data -pv
echo "PATH=/application/mysql/bin:$PATH" > /etc/profile.d/mysql.sh
source /etc/profile.d/mysql.sh
mv mysql-5.7.26-linux-glibc2.12-x86_64/* /application/mysql/
mysqld --initialize-insecure --user=mysql --basedir=/application/mysql --datadir=/data/mysql/data
vim /etc/my.cnf
[mysqld]
user=mysql
basedir=/application/mysql
datadir=/data/mysql/data
socket=/tmp/mysql.sock
server_id=6
port=3306
log_bin=/data/mysql/binlog/mysql-bin
character_set_server=utf8
[mysql]
socket=/tmp/mysql.sock
chown -R mysql.mysql /data/
service mysqld restart
mysql
grant replication slave on *.* to repl@'%' identified by '123';
互相操作
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 437 | | | |
+------------------+----------+--------------+------------------+-------------------+
help change master to;
CHANGE MASTER TO
MASTER_HOST='10.0.0.11',
MASTER_USER='repl',
MASTER_PASSWORD='123',
MASTER_PORT=3306,
MASTER_LOG_FILE='mysql-bin.000002',
MASTER_LOG_POS=154;
完成
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)