重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3307/data/ mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3308/data/ mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3309/data/
mysql -uroot -p123 -e "select @@server_id" mysql -uroot -p123 -e "select @@server_uuid"
mysql -uroot -p123 -e "select @@gtid_mode" mysql -uroot -p123 -e "select @@server_gtid" vi 330{7..9}/my.cnf gtid_mode=ON enforce_gtid_consistency=ON log_slave_updates=ON
mysql -uroot -p123 -e "select @@log_bin"
mysqldump -uroot -p123 -h 192.168.84.30 -P 3307 > /tmp/full.sql
mysql> source /tmp/full.sql
grant replication slave on *.* to repl@'192.168.84.30' identified by '123';
帮助: mysql> help change master to ...... 找到配置模板: CHANGE MASTER TO MASTER_HOST='master2.example.com', MASTER_USER='replication', MASTER_PASSWORD='password', MASTER_PORT=3306, MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4, MASTER_CONNECT_RETRY=10; 3308,3309使用如下配置: CHANGE MASTER TO MASTER_HOST='192.168.84.30', MASTER_USER='repl', MASTER_PASSWORD='123', MASTER_PORT=3307, master_auto_position=1; 开始配置3308 mysql> CHANGE MASTER TO -> MASTER_HOST='192.168.84.30', -> MASTER_USER='repl', -> MASTER_PASSWORD='123', -> MASTER_PORT=3307, -> master_auto_position=1; Query OK, 0 rows affected, 2 warnings (0.00 sec) 开始配置3309 mysql> CHANGE MASTER TO -> MASTER_HOST='192.168.84.30', -> MASTER_USER='repl', -> MASTER_PASSWORD='123', -> MASTER_PORT=3307, -> master_auto_position=1; Query OK, 0 rows affected, 2 warnings (0.00 sec)