Grant wgdp user query permission: grantselectonwg_dp. * towgdp @ % IDENTIFIEDBYweigou123; other *. * toyangchao @ % login query other mysql user permissions: showgrantsforwgdp; cancel wgdp user permission: revokeallon
Grant wgdp user query permission: grant select on wg_dp. * to 'wgdp '@' % 'identified by 'weigou123'; grant all privileges on *. * to 'yangshao' @ '%' identified by 'weigou123' query other mysql user permissions: show grants for wgdp; cancel wgdp User Permissions: revoke all on
Grant wgdp user query permission:
Grant select on wg_dp. * to 'wgdp '@' % 'identified by 'weigou123 ';
Grant all privileges on *. * to 'hangzhou' @ '% 'identified BY 'weighou123'
Query other mysql user permissions:
Show grants for wgdp;
Cancel wgdp User Permissions:
Revoke all on *. * from wgdp;
PS: grant. After the revoke user permission is granted, the permission takes effect only when the user reconnects to the MySQL database.
Permission range:
1. The select, insert, update, and delete permissions allow you to perform operations on an existing table in a database. They are basic permissions.
2. alter permission allows you to use ALTER TABLE
3. the 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, this user can discard the database that stores the MySQL access permission!
After mysql5.5, some of the master-slave configuration fields in the mysql configuration file my. cnf have been deprecated. To enable the master-slave configuration, follow these steps:
1. Preparations: There are two linux Hosts
Master: 10.209.112.58 the username of mysql5.5 master is root, no password,
Slave: 10.46.169.62 the username of mysql5.5 slave is root, no password, and the account used by slave to log on to the master for synchronization is wgdp_syc;
Allow slave TO log on to the master: grant all privileges on *. * TO 'wgdp _ syc' @ '10. 46.169.62 'identified by 'syc1qaz2wsx' with grant option; flush privileges;
2. Master:
Configure my. cnf for the master:
[Mysqld]
# Master configure
Server-id = 1
Log-bin = mysql-bin
Binlog-do-db = master
Binlog-ignore-db = mysql
# Master configure
Datadir =/var/lib/mysql
Socket =/var/lib/mysql. sock
The maser id should be 1, indicating the log directory, synchronized database, and databases that cannot be synchronized
Then add an account on the Master for synchronization, as shown below:
Grant replication slave on *. * TO rep@192.168.74.227 identified by 'hello ';
If you want to have the permission to execute the "load table from master" or "load data from master" Statement on Slave, you must grant the Global FILE and SELECT permissions:
Grant file, SELECT, replication slave on *. * TO rep@192.168.74.227 identified by 'hello ';
Next, back up the data on the Master, first execute the following SQL statement:
Flush tables with read lock;
Then Package the synchronized data tar, and then scp to the machine on which 227 is located. decompress the package and pay attention to permission issues.
After completing the steps, run
UNLOCK TABLES
3. Slave:
Configure my. cnf for slave:
[Mysqld]
# Configure master-slave
Server-id = 2
# Master-host = 192.168.74.225
# Master-user = rep
# Master-password = hello
Replicate-ignore-db = mysql
Replicate-do-db = master
# Configure master-slave
Note that the three fields of master-host in slave configuration have been commented out, because the configuration has been discarded since 5.5. After these three fields are set, run 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 the master-slave mysql instance, run the following command to check whether the problem exists:
SLAVE Database: mysql> show slave status \ G;
- Slave_IO_Running: yes
- Slave_ SQL _Running: Yes.
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)