MySQL Basics first phase, how to remotely access the MySQL database Set permissions method summary, discuss access to a single database, all databases, specify user access, set access password, specify access to the host.
1, set access to individual database permissions
Copy Code code as follows:
Mysql>grant all privileges in test.* to ' root ' @ '% ';
Note: Set user name as root, password is blank, access to database test
2, set access to all database permissions
Copy Code code as follows:
Mysql>grant all privileges in *.* to ' root ' @ '% ';
Note: Set username root, password is blank, access all databases *
3, set the specified user name access rights
Copy Code code as follows:
Mysql>grant all privileges in *.* to ' liuhui ' @ '% ';
Note: Set the specified user name as Liuhui, the password is blank, access all databases *
4, Set Password access rights
Copy Code code as follows:
Mysql>grant all privileges in *.* to ' liuhui ' @ '% ' identified by ' Liuhui ';
Note: Set the specified user name Liuhui, password is Liuhui, access all databases *
5, setting specify accessible host permissions
Copy Code code as follows:
Mysql>grant all privileges in *.* to ' Liuhui ' @ ' 10.2.1.11 ';
Note: Set the specified user name as Liuhui, access all databases *, only 10.2.1.11 this machine has access
You can also set the specified access to a data table under a database, please continue to focus on the MySQL Basics series.