Summary of the MySQL database Settings remote Access permissions method
- 2020-06-03 08:35:56
- OfStack
1. Set access permissions to a single database
mysql>grant all privileges on test.* to 'root'@'%';
Note: Set user name root, password is empty, you can access the database test
2, set access to all database permissions
mysql>grant all privileges on *.* to 'root'@'%';
Note: Set user name root, password is empty, access to all databases *
3. Set the access permissions for the specified user name
mysql>grant all privileges on *.* to 'liuhui'@'%';
Note: Set the specified user name liuhui with an empty password to access all databases *
4, set password access permissions
mysql>grant all privileges on *.* to 'liuhui'@'%' IDENTIFIED BY 'liuhui';
Note: Set the specified user name liuhui and password liuhui to access all databases *
5. Set and specify the permissions of the accessible host
mysql>grant all privileges on *.* to 'liuhui'@'10.2.1.11';
Note: Set the specified user name liuhui to access all databases *, only this machine has permission to access 10.2.1.11
You can also set up to specify access to a table under a database. Stay tuned for the MySQL Basics series.