Primary server Configuration
Give the server a separate ID
Server-id = 106
Set the binary save file
Log-bin = Mysql-bin
Binary log Format/mixed/row/statement
Binlog-format = Mixed
From server configuration
Server-id = 109
Log-bin = Mysql-bin
Binlog-format = Mixed
Relay-log = Mysql-relay
Restart MySQL Service
If prompt permission is not enough, you can start directly
Mysqld_safe--user=mysql &
MySQL boot prompt can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '
First look at the permissions enough and then see if MySQL has started
Service MYSQLD Status
If the prompt is not in the installation directory L for example:
Can ' t connect to local MySQL server through socket '/tmp/mysql.sock '
You can use Mysql-uroot-p-s/var/lib/mysql/mysql.sock
Or use a soft connection
In-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Go to MySQL to view the primary server status
Show master status;
If the instructions can be
View from server
show slave status;
If an empty reason may be the primary server is not authorized from the server
Grant replication client,replication slave on . to [e-mail protected] ' 192.168.0.% ' identified by ' repl ';
Flush privileges;
Read the master server's files from the server
Change Master to
Master_host = ' 192.168.0.106 ',
Master_user = ' Repl ',
Master_password = ' Repl ',
Master_log_file = ' mysql-bin.000001 ',
Master_log_pos = 106;
View connection Status
show slave status;
show slave status\g;
Indicates successful connection
Perform
Start slave;
Check again to see if the status is successful
show slave status\g;
If an error
Last_io_error:error connecting to master ' [email protected]:3306 '-retry-time:60 retries:86400
Problems with firewalls open ports or shut down firewalls
Restart from server
Note: If you are a production environment, you need to import a full backup of the primary server before replicating from the server, and then start the service at the POS location where the binary logs are logged after the backup from the primary server.
The primary server is running and has some data to rejoin from the server:
This procedure first backs up the data from the primary server and then copies it to the database that is imported from the server to the server, and then backs up the data from the server at the specified location from the primary server.
MySQL Master-slave replication