MySQL User rights Assignment and master-slave synchronous replication

Source: Internet
Author: User

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 the user right, the user must reconnect to the MySQL database before the permission takes 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
The 2.alter permission allows you to use alter TABLE
3.create and Drop permissions allow you to create new databases and tables, or discard (delete) existing databases and tables if you grant the drop permission of the MySQL database to a user, the user can discard the database where MySQL access is stored! 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 the user name of master is root, no password,

slave:10.46.169.62 mysql5.5 slave user name is root, no password, Slave login Master to synchronize the account is wgdp_syc;

allow slave to log in to 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

The ID of the maser should be 1, indicating the log directory, synchronizing the database, not allowing the synchronized database

Then add an account on master that is dedicated to synchronization, as follows:
GRANT REPLICATION SLAVE On * * to [e-mail protected] identified by ' Hello ';
Global FILE and select permissions must be granted if you want to have permissions on the slave to execute the "load TABLE from master" or "Load DATA from master" statements:
GRANT file,select,replication SLAVE On * * to [e-mail protected] identified by ' Hello ';
Next back up the data on master, first execute the following SQL statement:
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 completed, the execution
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 in Master-host in slave's configuration were commented out, Since this configuration has been deprecated after 5.5, these three fields are set by logging in to slave MySQL after executing 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;
    1. Slave_io_running:yes
    2. Slave_sql_running:yes So, even if it's almost
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.