Grant WGDP user Query permission: Grants select on wg_dp.* to ' WGDP ' @ '% ' identified by ' weigou123 ';Grant all privileges on * * to' Yangchao ' @ '% 'identified by ' weigou123 'Query MySQL Other user rights: show grants for WGDP; cancel WGDP user rights: Revoke all on * * from WGDP; Ps:Grant, REVOKE user rights, the user only once again connected to the MySQL database, the ability to take effect. Permission range:1.select, INSERT, UPDATE, and delete permissions allow you to implement operations on an existing table on a database, which is a basic permission
2.alter Permissions agree you use alter TABLE
3.create and Drop permissions allow you to create new databases and tables, or discard (delete) existing databases and tables assume that you grant the drop permission of the MySQL database to a user who can discard a database that stores MySQL access rights! mysql5.5 After the MySQL configuration file my.cnf in the master-slave configuration of some of the fields have been discarded, to open the master-slave steps:
1. Preparation, there are two Linux hosts
master:10.209.112.58 mysql5.5 Master's username is root, no password,
slave:10.46.169.62 mysql5.5 Slave's username is root, no password, Slave login Master to synchronize the account is wgdp_syc;
agree to slave login master: GRANT All privileges on * * to ' WGDP_SYC ' @ ' 10.46.169.62 ' identified by ' syc1qaz2wsx ' with GRANT OPTION; flush privileges;
2. Main:Configure the MY.CNF for master:[Mysqld] #master Configureserver-id = 1log-bin=mysql-binbinlog-do-db=masterbinlog-ignore-db=mysql#master Configuredatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock
Maser ID should be 1, description log folder, synchronize database, do not agree to synchronize database
Then add an account on master that is dedicated to syncing, such as the following:
GRANT REPLICATION SLAVE On * * to [e-mail protected] identified by ' Hello ';
If you want to have permission to run the "Load TABLE from master" or "Load DATA from master" statement on Slave, you must grant global FILE and SELECT permissions:
GRANT file,select,replication SLAVE On * * to [e-mail protected] identified by ' Hello ';
Next, back up the data on master, and first run the following SQL statement, for example:
FLUSH TABLES with READ LOCK;
Then the synchronized data tar is packaged, then SCP to 227 on that machine, decompression, attention to permissions issues
After the entire step is complete, run
UNLOCK TABLES
3. From:Configure the slave my.cnf:[Mysqld] #configure master-slaveserver-id=2#master-host=192.168.74.225#master-user=rep#master-password= Helloreplicate-ignore-db=mysqlreplicate-do-db=master#configure Master-slave noticed that the three fields of Master-host in slave's configuration were peered out, Since this configuration has been deprecated after 5.5, these three fields are set by logging in to slave MySQL after running the following statement:mysql> change MASTER to Master_host= '10.209.112.58', master_user= ' wgdp_syc ', master_password= 'syc1qaz2wsx', master_log_file= ' mysql-bin.000001 ', master_log_pos=0; 4. After starting master-slave MySQL, verify the problem with the following command:from library: MySQL>SHOW SLAVE status\g;
- Slave_io_running:yes
- Slave_sql_running:yes So, even if it's almost the same.
MySQL database synchronization error, skip:mysql> slave stop; Query OK, 0 rows affected (0.01 sec) mysql> SET GLOBAL sql_slave_skip_counter = 1; Query OK, 0 rows Affected (0.00 sec) mysql> slave start; Query OK, 0 rows Affected (0.00 sec)
MySQL User rights Assignment and master-slave synchronous replication