Summary of how to set remote access permissions for MySQL database: bitsCN. the first part of the basic knowledge of comMySQL is the summary of how to set permissions for remote access to MySQL databases. it discusses how to access a single database, all databases, specify user access, set access passwords, and specify access hosts.
1. set the permissions to access a single database
Mysql> grant all privileges on test. * to 'root' @ '% ';
Note: the user name is set to root, and the password is blank. you can access the database test.
2. set all database access permissions
Mysql> grant all privileges on *. * to 'root' @ '% ';
Note: Set the username to root and the password to null to allow access to all databases *
3. set the access permission for the specified user name
Mysql> grant all privileges on *. * to 'liuhui' @ '% ';
Note: Set the specified user name to liuhui and the password to be blank to allow access to all databases *
4. set password access permissions
Mysql> grant all privileges on *. * to 'liuhui' @ '%' identified by 'liuhui ';
Note: Set the specified user name to liuhui and the password to liuhui to access all databases *
5. set the specified accessible host permissions.
Mysql> grant all privileges on *. * to 'liuhui' @ '10. 2.1.11 ';
Note: Set the specified user name to liuhui to access all databases. * only the machine 10.2.1.11 has the permission to access the database.
You can also set to access a data table in a database. follow the MySQL Basics series.
BitsCN.com