Ubuntu configures the Mysql master slave database

  • 2020-06-23 02:05:06
  • OfStack

Environment: Virtual machine down

Server: Ubuntu 14.04 LTS

Database: 5.5.37
Port: 3306

The main IP: 192.168.63.133

From IP: 192.168.63.134

Authorized Account:

user:suxh

password:111111

Finished with the environment: We will directly configure:

Step 1: Master and slave servers should have the same database (synchronous). In this case, the backup database is used. (Needless to say, just make a copy of the master database to the slave database before synchronization.)

Step 2 Configure master (master) database edit /etc/ ES31en. cnf is mainly used to turn on the base 2 log and set the database to be synchronized


# binary logging format - mixed recommended
binlog_format=mixed
binlog-ignore-db=mysql
binlog-do-db=backup
 
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id    = 1


Parameter explanation:

server-id this is the only one that can't be the same as the server.

binlog_format 2 base file format

binlog_ignore-db ignored database

binlog-do-db the database to synchronize with

After setting up, restart the database.

Step 3 From the database:

Similarly modify /etc/ ES62en.cnf in mysql version 5.1.7 not support master-ES66en "similar parameters; So just configure ES67en-ES68en =2

Then log in from the database Settings


change master to master_host='192.168.63.133', master_user='suxh', master_password='111111';
slave start;


Basic configuration is good. Here are my brief notes.


Related articles: