Home > Database > Mysql Tutorial > How to create a user in MySQL?

How to create a user in MySQL?

黄舟
Release: 2017-08-02 09:59:42
Original
2569 people have browsed it

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.

How to create a user in MySQL?

2. The initial content of the table is:

How to create a user in MySQL?

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';
Copy after login

How to create a user in MySQL?

## 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?

How to create a user in MySQL?

2. Refined to:

How to create a user in MySQL?

##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 ......
Copy after login

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';
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template