Home >Database >Mysql Tutorial >How to create a user in MySQL?
MysqlHow to create a user
1: First look at the storage location of user information:
1. Users in mysql are stored in the system database "mysql" of the mysql system.
2. The initial content of the table is:
2: Create user:
1.create user 'Username'@'Location where login is allowed' identified by 'Password'
Example:
create user 'user1'@'192.168.44.64' identified by '123';
## Three: Permission management:
1. What are the permissions?
Permission is the right to do something, such as "insert", create, update, and delete. . . . "all" means "all permissions"In fact, in the mysql system, permissions are the above-mentioned "words";What permissions are there?2. Refined to:
##Four: Grant user permissions
1.grant permission 1, permission 2, .... on a certain library. A subordinate unit to 'user name'@ 'Location allowed to log in' [identified by 'password']Description:
1, permission names such as:
insert, update, select, delete, create, drop ......
2. "A certain subordinate unit" refers to the subordinate data elements in a library. Currently we have only learned 2: table and view;
For example: php44.Student table or php44. int_test
has two special writing methods:
*.*: represents all subordinate units in all databases;
a certain library.*: represents all subordinate units in the database Unit
3, if permission is granted to an existing user, the identified part can be omitted. If not omitted, it means changing the password;And for a new user The user (that is, 'username'@'location where login is allowed' does not exist yet), the identified part cannot be omitted, and the grant statement actually creates a new user!
##2. You can also grant "all permissions":
grant all privileges on php44.* to 'user1'@'192.168.44.64';
5: Cancel user permissions
revoke Permission 1, Permission 2, .... on a library. A subordinate unit from 'Username'@' allows login s position'Explanation:
1 means the same as the grant statement;
2 means to cancel certain permissions of a user on a certain data unit.
The above is the detailed content of How to create a user in MySQL?. For more information, please follow other related articles on the PHP Chinese website!