LINUX MYSQL new account number and permission setting method

LINUX under MySQL new account number and permissions setting method. In fact, Linux is the same as the setting method under Windows, all of which are command line operation
1, permissions given

Note: MySQL is deployed on server A, and the internal network host B is connected to the server A through the client tool A to perform database operations.

1.1 Enter mysql on the server A. Suppose the MySQL account on the server A is root: ROOT:

Copy codecode is as follows:
mysql – u root -p

and then enter the password!

1.2 Give the host B’s permissions to operate the database

Copy codecode is as follows:
mysql> grant usage on *.* to [email protected] identified by ‘password’;

Note: Give [email protected] The permissions of using all databases, use Username account to log in on the host 192.168.0.1

Copy codecode is as follows:
mysql> grant all privileges on newdb.* to [email protected];

Note: Gives the highest permissions of [email protected] operation database Newdb, use the Username account to log in on the host 192.168.0.1, no password password without password

Example:

Copy codecode is as follows:
mysql> grant all privileges on *.* to [email protected] identified by ‘123456’ ;

Note: [email protected] uses the permissions of all databases, use the root account to log in on the host 192.168.0.1, the password is: 123456

2, remove the account

Copy codecode is as follows:
mysql> drop user [email protected];

Instructions: Remove the account root, so that the host 192.168.0.1 will no longer use the database on the root user to operate the server A

Leave a Reply

Your email address will not be published. Required fields are marked *