一、架构

三台msyql服务器221,222,223,每台服务器开两个实例,3306作为主库,3307作为另外一台服务器的从库

二、每台服务器安装双实例

参照:https://www.cnblogs.com/sky-cheng/p/10919447.html

进行双实例安装

三、每台服务器的3306实例创建一个复制账号

在172.28.5.221上

[root@push-5-221 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 16Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> grant replication slave,replication client on *.* to 'repl'@'%' identified by 'XXXXXXX';

Query OK,0 rows affected, 1 warning (0.00sec)

mysql>

在172.28.5.222上

[root@push-5-222 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 11Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> grant replication slave,replication client on *.* to 'repl'@'%' identified by 'XXXXXXXX';

Query OK,0 rows affected, 1 warning (0.01sec)

mysql>flush privileges;

Query OK,0 rows affected (0.00sec)

mysql>

在172.28.5.223上

[root@push-5-223 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 7Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> grant replication slave,replication client on *.* to 'repl'@'%' identified by 'xxxxxxxx';

Query OK,0 rows affected, 1 warning (0.00sec)

mysql>flush privileges;

Query OK,0 rows affected (0.00sec)

mysql>

三、主从配置

1、首先设置好每个3306mysql实例的server_id参数为本机IP地址最后一位,3307实例server_id参数为本机IP地址最后一位再加端口号

在172.28.5.221服务器的3306配置文件中打开日志文件设置

[root@push-5-221 ~]# vim /etc/mysql/my-3306.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]

# innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3306datadir=/home/mysql-5.7.26/data/3306socket=/var/lib/mysql/3306/mysql.sock

server_id=2213306log-bin=master-221binlog_format=row

#skip-grant-tables

symbolic-links=0pid-file=/var/run/mysqld/3306/mysqld.pid

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

[mysqld_safe]

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

server_id=221 设置server_id

log-bin=master-221 设置log_bin日志文件名

binlog_format=row 指定日志格式为row

2、重启3306实例,使配置生效

[root@push-5-221 ~]# mysqladmin -uroot -p -S /var/lib/mysql/3306/mysql.sock shutdown

[root@push-5-221 ~]# mysqld_safe --defaults-file=/etc/mysql/my-3306.cnf &[1] 3459[root@push-5-221 ~]# 2019-05-27T02:55:18.758733Z mysqld_safe Logging to '/home/mysql-5.7.26/log/3306/mysqld.log'.2019-05-27T02:55:18.813602Z mysqld_safe Starting mysqld daemon with databases from /home/mysql-5.7.26/data/3306

3、客户端连接

^C

[root@push-5-221 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 2Server version:5.7.26-log MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clear the current input statement.

4、显示server_id参数

mysql> show variables like '%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2213306 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.00 sec)

5、显示主库状态

mysql>show master status\G;*************************** 1. row ***************************File: master-221.000002Position:154Binlog_Do_DB:

Binlog_Ignore_DB:

Executed_Gtid_Set:1 row in set (0.00sec)

ERROR:

No query specified

此时,需要记住上面的参数:  File: master-221.000001   Position: 154 ,日志文件名和偏移量,需要在从库上做主从设置时要用到这两个参数

6、从库设置

在172.28.5.222服务器上的3307配置文件

[mysqld]

# innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3307datadir=/home/mysql-5.7.26/data/3307socket=/var/lib/mysql/3307/mysql.sock

server_id=2223307symbolic-links=0pid-file=/var/run/mysqld/3307/mysqld.pid

log-error=/home/mysql-5.7.26/log/3307/mysqld.log

[mysqld_safe]

log-error=/home/mysql-5.7.26/log/3307/mysqld.log

7、重启3307实例,使配置生效

[root@push-5-222 ~]# mysqladmin -uroot -p -S /var/lib/mysql/3307/mysql.sock shutdown

[root@push-5-222 ~]# mysqld_safe --defaults-file=/etc/mysql/my-3307.cnf &[1] 23445[root@push-5-222 ~]# 2019-05-27T03:11:33.550199Z mysqld_safe Logging to '/home/mysql-5.7.26/log/3307/mysqld.log'.2019-05-27T03:11:33.610157Z mysqld_safe Starting mysqld daemon with databases from /home/mysql-5.7.26/data/3307

8、查看相应参数

[root@push-5-222 ~]# mysql -uroot -p -S /var/lib/mysql/3307/mysql.sock

mysql> show variables like '%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2223307 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.00 sec)

9、执行从库命令

mysql>change master to-> master_host='172.28.5.221',-> master_port=3306,-> master_user='repl',-> master_password='xxxxxxxx',-> master_log_file='master-221.000002',-> master_log_pos=154;

Query OK,0 rows affected, 2 warnings (0.31 sec)

10、启动从库

mysql>start slave;

Query OK,0 rows affected (0.05 sec)

11、显示从库状态

mysql>start slave;

Query OK,0 rows affected (0.05sec)

mysql>show slave status\G;*************************** 1. row ***************************Slave_IO_State: Waitingformaster to send event

Master_Host:172.28.5.221Master_User: repl

Master_Port:3306Connect_Retry:60Master_Log_File: master-221.000002Read_Master_Log_Pos:154Relay_Log_File: push-5-222-relay-bin.000002Relay_Log_Pos:321Relay_Master_Log_File: master-221.000002Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno:0Last_Error:

Skip_Counter:0Exec_Master_Log_Pos:154Relay_Log_Space:533Until_Condition: None

Until_Log_File:

Until_Log_Pos:0Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master:0Master_SSL_Verify_Server_Cert: No

Last_IO_Errno:0Last_IO_Error:

Last_SQL_Errno:0Last_SQL_Error:

Replicate_Ignore_Server_Ids:

Master_Server_Id:2213306Master_UUID: 3e61e5be-7dff-11e9-8945-6c2b5992e632

Master_Info_File:/home/mysql-5.7.26/data/3307/master.infoSQL_Delay:0SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waitingfor more updates

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

同步线程都已经启动成功、

Exec_Master_Log_Pos: 154 同步主库日志文件偏移量跟主库的日志文件偏移量相同,说明已经完全同步

12、测试同步

在172.28.5.221上创建test库和test表,并插入一条记录

mysql>create database test;

Query OK,1 row affected (0.12sec)

mysql>show databases;+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

| test |

+--------------------+mysql>use test;

Database changed

mysql> create table test( uid int, name varchar(20));

Query OK,0 rows affected (0.43sec)

mysql> insert into test(uid,name)values(1,'aaaa');

Query OK,1 row affected (0.14sec)

mysql> select *from test;+------+------+

| uid | name |

+------+------+

| 1 | aaaa |

+------+------+

1 row in set (0.00 sec)

此时,在172.28.5.222上连接从库3307

[root@push-5-222 ~]# mysql -uroot -p -S /var/lib/mysql/3307/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 5Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql>show databases;+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

| test |

+--------------------+

5 rows in set (0.00sec)

mysql>use test;

Reading table informationforcompletion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

mysql>show tables;+----------------+

| Tables_in_test |

+----------------+

| test |

+----------------+

1 row in set (0.00sec)

mysql> select *from test;+------+------+

| uid | name |

+------+------+

| 1 | aaaa |

+------+------+

1 row in set (0.00 sec)

已经跟主库数据同步成功了。

同样在172.28.5.222上将3306配置文件打开

[mysqld]

#innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3306datadir=/home/mysql-5.7.26/data/3306socket=/var/lib/mysql/3306/mysql.sock

server_id=2223306log-bin=master-222binlog_format=row

#skip-grant-tables

symbolic-links=0pid-file=/var/run/mysqld/3306/mysqld.pid

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

[mysqld_safe]

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

重启3306实例

[root@push-5-222 ~]# mysqladmin -uroot -p -S /var/lib/mysql/3306/mysql.sock shutdown

Enter password:

[root@push-5-222 ~]# mysqld_safe --defaults-file=/etc/mysql/my-3306.cnf &[2] 24587[root@push-5-222 ~]# 2019-05-27T03:29:21.804192Z mysqld_safe Logging to '/home/mysql-5.7.26/log/3306/mysqld.log'.2019-05-27T03:29:21.864191Z mysqld_safe Starting mysqld daemon with databases from /home/mysql-5.7.26/data/3306[root@push-5-222 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 2Server version:5.7.26-log MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> show variables like '%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2223306 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.01sec)

mysql>show msater status\G;

ERROR1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'msater status' at line 1ERROR:

No query specified

mysql>show master status\G;*************************** 1. row ***************************File: master-222.000001Position:154Binlog_Do_DB:

Binlog_Ignore_DB:

Executed_Gtid_Set:1 row in set (0.00sec)

ERROR:

No query specified

显示主库状态

在172.28.5.223服务器上打开3307配置文件,将其设置为172.28.5.222的3306的从库

[root@push-5-223 ~]# vim /etc/mysql/my-3307.cnf

[mysqld]

# innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3307datadir=/home/mysql-5.7.26/data/3307socket=/var/lib/mysql/3307/mysql.sock

server_id=2233307#log-bin=master-223#binlog_format=row

#skip-grant-tables

symbolic-links=0pid-file=/var/run/mysqld/3307/mysqld.pid

log-error=/home/mysql-5.7.26/log/3307/mysqld.log

[mysqld_safe]

log-error=/home/mysql-5.7.26/log/3307/mysqld.log

客户端连接,设置从库命令

[root@push-5-223 ~]# mysql -uroot -p -S /var/lib/mysql/3307/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 3Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> show variables like '%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2233307 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.00sec)

mysql>change master to-> master_host='172.28.5.222',-> master_port=3306,-> master_user='repl',-> master_password='xxxxxx',-> master_log_file='master-222.000001',-> master_log_pos=154;

Query OK,0 rows affected, 2 warnings (0.36 sec)

启动从库

mysql>start slave;

Query OK,0 rows affected (0.05sec)

mysql>show slave status\G;*************************** 1. row ***************************Slave_IO_State: Waitingformaster to send event

Master_Host:172.28.5.222Master_User: repl

Master_Port:3306Connect_Retry:60Master_Log_File: master-222.000001Read_Master_Log_Pos:154Relay_Log_File: push-5-223-relay-bin.000002Relay_Log_Pos:321Relay_Master_Log_File: master-222.000001Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno:0Last_Error:

Skip_Counter:0Exec_Master_Log_Pos:154Relay_Log_Space:533Until_Condition: None

Until_Log_File:

Until_Log_Pos:0Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master:0Master_SSL_Verify_Server_Cert: No

Last_IO_Errno:0Last_IO_Error:

Last_SQL_Errno:0Last_SQL_Error:

Replicate_Ignore_Server_Ids:

Master_Server_Id:2223306Master_UUID: de99b6b7-8018-11e9-9a45-6c2b5992e6d2

Master_Info_File:/home/mysql-5.7.26/data/3307/master.infoSQL_Delay:0SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waitingfor moreupdates

Master_Retry_Count:86400Master_Bind:

Last_IO_Error_Timestamp:

Last_SQL_Error_Timestamp:

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set:

Executed_Gtid_Set:

Auto_Position:0Replicate_Rewrite_DB:

Channel_Name:

Master_TLS_Version:

此时,从库已经启动,并且同步线程启动成功,同步完毕

测试数据

在172.28.5.222的3306上创建test库个test表,并插入一条数据

mysql>create database test;

Query OK,1 row affected (0.11sec)

mysql>use test;

Database changed

mysql> create table test (uid int,name varchar(20));

Query OK,0 rows affected (0.26sec)

mysql> insert into test values(1,'bbbb');

Query OK,1 row affected (0.15sec)

mysql> select *from test;+------+------+

| uid | name |

+------+------+

| 1 | bbbb |

+------+------+

1 row in set (0.00 sec)

此时,在172.28.5.223上连接3307从库

[root@push-5-223 ~]# mysql -uroot -p -S /var/lib/mysql/3307/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 6Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql>use test;

Reading table informationforcompletion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

mysql> select *from test;+------+------+

| uid | name |

+------+------+

| 1 | bbbb |

+------+------+

1 row in set (0.00 sec)

数据同步成功。

同样在172.28.5.223的3306和172.28.5.221的3307做主从配置

编辑172.28.5.223的3306配置文件

[root@push-5-223 ~]# vim /etc/mysql/my-3306.cnf

[mysqld]

# innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3306datadir=/home/mysql-5.7.26/data/3306socket=/var/lib/mysql/3306/mysql.sock

server_id=2233306log-bin=master-223binlog_format=row

#skip-grant-tables

symbolic-links=0pid-file=/var/run/mysqld/3306/mysqld.pid

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

[mysqld_safe]

log-error=/home/mysql-5.7.26/log/3306/mysqld.log

重启3306实例

[root@push-5-223 ~]# mysqladmin -uroot -p -S /var/lib/mysql/3306/mysql.sock shutdown

Enter password:

[root@push-5-223 ~]# mysqld_safe --defaults-file=/etc/mysql/my-3306.cnf &[2] 10352[root@push-5-223 ~]# 2019-05-27T03:46:18.899652Z mysqld_safe Logging to '/home/mysql-5.7.26/log/3306/mysqld.log'.2019-05-27T03:46:18.965604Z mysqld_safe Starting mysqld daemon with databases from /home/mysql-5.7.26/data/3306

^C

[root@push-5-223 ~]# mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 2Server version:5.7.26-log MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> show variables like'%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2233306 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.01sec)

mysql>show master status \G*************************** 1. row ***************************File: master-223.000001Position:154Binlog_Do_DB:

Binlog_Ignore_DB:

Executed_Gtid_Set:1 row in set (0.00 sec)

主库启动成功

在172.28.5.221的3307配置文件

[root@push-5-221 ~]# vim /etc/mysql/my-3307.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]

# innodb_buffer_pool_size=128M

# join_buffer_size=128M

# sort_buffer_size=2M

# read_rnd_buffer_size=2M

user=mysql

port=3307datadir=/home/mysql-5.7.26/data/3307socket=/var/lib/mysql/3307/mysql.sock

server_id=2213307# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0log-error=/home/mysql-5.7.26/log/3307/mysqld.log

pid-file=/var/run/mysqld/3307/mysqld.pid

[myqld_safe]

log-error=/home/mysql-5.7.26/log/3307/mysqld.log

重启3307实例

[root@push-5-221 ~]# mysqladmin -uroot -p -S /var/lib/mysql/3307/mysql.sock shutdown

[root@push-5-221 ~]# mysqld_safe --defaults-file=/etc/mysql/my-3307.cnf &[2] 6725[root@push-5-221 ~]# 2019-05-27T03:49:31.427996Z mysqld_safe Logging to '/home/mysql-5.7.26/log/3307/mysqld.log'.2019-05-27T03:49:31.482868Z mysqld_safe Starting mysqld daemon with databases from /home/mysql-5.7.26/data/3307

^C

[root@push-5-221 ~]# mysql -uroot -p -S /var/lib/mysql/3307/mysql.sock

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connectionid is 2Server version:5.7.26MySQL Community Server (GPL)

Copyright (c)2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type'help;' or '\h' for help. Type '\c' to clearthe current input statement.

mysql> show variables like '%server_id%';+----------------+---------+

| Variable_name | Value |

+----------------+---------+

| server_id | 2213307 |

| server_id_bits | 32 |

+----------------+---------+

2 rows in set (0.01 sec)

执行从库命令

mysql>change master to-> master_host='172.28.5.223',-> master_port=3306,-> master_user='repl',-> master_password='Zaq1xsw@',-> master_log_file='master-223.000001',-> master_log_pos=154;

Query OK,0 rows affected, 2 warnings (0.42sec)

mysql>start slave;

Query OK,0 rows affected (0.06sec)

mysql>

测试数据

在172.28.5.223的3306创建test库和test表,并插入一条记录

mysql>create database test;

Query OK,1 row affected (0.06sec)

mysql>use test;

Database changed

mysql> create table test(id int,name varchar(10));

Query OK,0 rows affected (0.34sec)

mysql> insert into test values(1,'ccc');

Query OK,1 row affected (0.14sec)

mysql> select *from test;+------+------+

| id | name |

+------+------+

| 1 | ccc |

+------+------+

1 row in set (0.00 sec)

在172.28.5.221的3307上查看

sion for the right syntax to use near 'database' at line 1mysql>show databases;+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

| test |

+--------------------+

5 rows in set (0.00sec)

mysql>use test;

Reading table informationforcompletion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

mysql> select *from test;+------+------+

| id | name |

+------+------+

| 1 | ccc |

+------+------+

1 row in set (0.00 sec)

数据同步成功

至此3台MYSQL服务器互为主从设置完毕。

四、多实例的启动和停止

停止3306实例:  mysqladmin -uroot -p -S /var/lib/mysql/3307/mysql.sock shutdown

启动3306实例: mysqld_safe --defaults-file=/etc/mysql/my-3306.cnf &

连接3306实例:mysql -uroot -p -S /var/lib/mysql/3306/mysql.sock

mysql5.7 server id_三台mysql5.7服务器互作主从配置案例相关推荐

  1. 无线ldap认证服务器,结合LDAP服务器进行portal认证配置案例

    查看LDAP服务器 首先登录LDAP服务器,可以看到h3c.com下有一个组织单元"工程部",其下有两个用户"gongcheng01"和"gongch ...

  2. centos7.3 mysql5.7_CentOS7.3 yum install MySQL5.7

    1.更新 yum mysql5.7 源 2.yum mysql 源配置 禁用MySQL5.6的源:#yum-config-manager --disable mysql56-community 启用M ...

  3. linux安装mysql5.6整套_Linux安装Mysql5.6

    由于安装的mysql8.0和其他服务器的数据库(版本5.1.30)由于版本差异过大,无法通信,因此需要安装一个中间版本5.6,但是它的安装过程和mysql8.0安装略有不同. 解压文件 // 解压文件 ...

  4. Apache2.2.8、php5.2.6、mysql5、phpMyAdmin2.11.6在Windows 下的安装和配置

    Apache2.2.8.php5.2.6.mysql5.phpMyAdmin2.11.6在Windows 下的安装和配置 最近开始捣鼓PHP,于是乎,先要配置好运行开发环境,鉴于现在系统是Vista, ...

  5. 安装mysql5.5.37_002. Centos7安装mysql5.5.37

    (百度网盘的连接地址使用wget下载不了) 4. 将上面三个包, 传到服务器上, 并解压 [root@iZ25bdzgev8Z mysql-5.5.37]# tar xvf mysql-5.5.37. ...

  6. mysql5.7.25安装包,Mysql5.7.25在windows下安装

    在网上看到了很多安装方法,也试了很多,md,网上资源多了也是有各种坑,这里只说在windows下安装mysql5.7.25 一.下载安装包 下载后解压到自己想要安装的目录,我的是:D:\MYSQL\ ...

  7. mysql5.1win7_免安装版mysql5.1.57在win7下成功配置

    mysql下载回来之后解压到D:/mysql-5.1.57-win32,把D:/mysql-5.1.57-win32/bin加入到系统环境变量Path中. 然后需要简单的配置mysql数据库,把my- ...

  8. 编译安装mysql5.5.39_编译安装MySQL5.5

    防伪码:没有相当程度的孤独是不可能有内心的平和. 1.测试环境 主机名 IP 系统 MySQL版本 MySQL-00 192.168.10.23 CentOS release 6.9 (Final) ...

  9. centos7下源码安装mysql5.6_Centos7 源码安装mysql5.6

    mysql下载 谷歌 mysql->community->mysql community server->mysql community server 5.6->Select ...

最新文章

  1. 关闭Struts2中s:property的HTML自动转码
  2. 用shell写了一个自动编译代码的脚本
  3. VTK:几何对象之Triangle
  4. TP5 验证码功能实现(解决点击验证码不更新的问题)
  5. JAVA入门级教学之(浮点型数据类型)
  6. 常用Smarty变量操作符
  7. CLR的程序集定位算法(转)
  8. JAVA 设计模式 职责链模式
  9. Windows下命令模式安装mysql
  10. 多标签图像分类任务的评价方法——mAP
  11. 计算机组成原理 - 基本概念
  12. 数据预处理之数据清洗案例
  13. RFID室内定位技术原理浅析-RFID室内人员定位-新导智能
  14. 如何扩展硬盘以及删除恢复分区?
  15. webpack 拾翠:充分利用 CommonsChunkPlugin()
  16. tsconfig之include和exclude详解
  17. vue打包时页面布局出现混乱
  18. ineligible devices xcode6.3
  19. lly的数列询问(最小生成树 + 思维)
  20. 品牌生命周期和产品生命周期之间的关系

热门文章

  1. PHP常用数组函数(含按键值删除二维数组中的元素)
  2. 计算机科学与技术创新实验班是什么意思,计算机科学与技术系成立2010级创新实验班(图)...
  3. python自动化部署程序,聊聊Python自动化脚本部署服务器全流程(详细)
  4. 动画,视频处理的计算机系统,音视频与动画处理.ppt
  5. 如何使用html和css,如何使用html和css制作这个div?
  6. mysql read file_MySQL利用OS读写文件的前提
  7. linux path在哪个文件夹,linux PATH环境变量全解析
  8. apply和call
  9. 数据结构(一)--稀疏数组
  10. 计算机系统操作工培训视频,计算机系统操作工培训第三篇.ppt