How to view MySQL user permissions

Source: Internet
Author: User
Tags mysql index

How can I view MySQL user permissions? The following describes how to view MySQL user permissions and the statements that grant MySQL user permissions for your reference.

View MySQL user permissions:

Show grants for your users

For example:
Show grants for root @ 'localhost ';

Grant usage

Grant usage on *. * TO 'discuz' @ 'localhost' identified by password' * c242ddd213be9c6f8da28d4245bf69fc79a86eb ';
Grant all privileges on 'discuz'. * TO 'discuz' @ 'localhost ';

Let me explain the meaning of the above two sentences according to my understanding.
Create a user name that can only be logged on locally. The discuz password is ***** encrypted.
In the second sentence, grant the discuz user all the permissions to operate the discuz database.

Use GRANT

The GRANT command is used to create a new user, specify the user password, and add user permissions. The format is as follows:

Mysql> GRANT <privileges> ON <what>
-> TO <user> [identified by "<password>"]
-> [With grant option];


As you can see, this command contains a lot of content to be filled in. Let's introduce them one by one, and finally give some examples to give you an understanding of their collaborative work.

<Privileges> is a comma-separated list of MySQL user permissions you want to grant. You can specify three types of permissions:

Database/data table/data column permissions: Alter: Modify existing data tables (such as adding/deleting columns) and indexes.
Create: Create a new database or data table.
Delete: Delete table records.
Drop: delete a data table or database.
INDEX: Create or delete an INDEX.
Insert: Add Table records.
Select: displays/searches for table records.
Update: Modify existing records in the table.

Global Management of MySQL user permissions:

File: read and write files on the MySQL server.
PROCESS: displays or kills service threads of other users.
RELOAD: RELOAD Access Control tables and refresh logs.
SHUTDOWN: Shut down the MySQL service.

Special permissions:

ALL: allow anything (same as root ).
USAGE: Only logon is allowed. Other operations are not allowed.

Statements that grant MySQL user permissions

Provides you with an in-depth understanding of MySQL permission management.

Mysql index Comparison Analysis

Use of MySQL EXPLAIN statements

MySQL database connection command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.