1. Grant Permissions
Description: mysql is deployed on server A. Host B on the Intranet connects to server A through client tools for database operations. Server A needs to grant host B the permission to operate mysql.
1.1 log on to mysql on server A. Assume that the mysql account on server A is root:
Copy codeThe Code is as follows:
Mysql-u root-p
Then press enter to enter the password!
1.2 grant database operation permissions to host B
Copy codeThe Code is as follows:
Mysql> grant usage on *. * to username@192.168.0.1 identified by 'Password ';
(Grant username@192.168.0.1 to use all the database permissions, on the host 192.168.0.1 using username Account Login, password: password)
Copy codeThe Code is as follows:
Mysql> grant all privileges on newdb. * to username@192.168.0.1;
(Grant username@192.168.0.1 operation database newdb the highest permissions, on the host 192.168.0.1 using username Account Login, no password)
Example:
Copy codeThe Code is as follows:
Mysql> grant all privileges on *. * to root@192.168.0.1 identified by '20140901 ';
(Grant root@192.168.0.1 to use all the database permissions, on the host 192.168.0.1 use root Account Login, password: 123456)
2. Remove an account
Copy codeThe Code is as follows:
Mysql> drop user root@192.168.0.1;
Remove the root account. In this way, the host 192.168.0.1 can no longer use the root user to operate the database on server.