MySQL User rights detailed

Source: Internet
Author: User

What should I do if I need to see MySQL user rights? Here's how you can view MySQL user rights, and a statement that gives MySQL user permissions is described for your reference.

To view MySQL user rights:

Show grants for your users

Like what:
Show grants for [email protected] ' localhost ';

Grant usage

GRANT USAGE on *. discuz ' @ ' localhost ' identified by PASSWORD ' *c242ddd213be9c6f8da28d49245bf69fc79a86eb ';
GRANT all Privileges "discuz". * to ' discuz "@ ' localhost ';

I'll explain what I mean by the above two sentences.
Set up a user name Discuz password that can only be logged on locally to be encrypted.
And then the second sentence means, give this discuz user all permissions to the Discuz database

Using the grant

The grant command is used to establish a new user, specify a user password, and increase user permissions. The format is as follows:

Mysql> GRANT <privileges> on <what>
<user> [Identified by "<password>"]
, [with GRANT OPTION];


As you can see, there are many things to fill in this command. Let's take a look at each of them and finally give some examples to get a sense of how they work together.

<privileges> is a comma-delimited list of MySQL user rights that you want to give. The permissions you can specify can be divided into three types:

Database/data Table/Data column permissions:

Alter: Modifies an existing data table (for example, add/Remove Columns) and index.
Create: Create a new database or data table.
Delete: Deletes the record for the table.
Drop: Deletes a data table or database.
Index: Establish or delete the indexes.
Insert: Adds a table record.
Select: Displays/searches the table's records.
Update: Modifies a record that already exists in the table.

To manage MySQL user rights globally:

File: Read and write files on the MySQL server.
PROCESS: Displays or kills service threads belonging to other users.
RELOAD: Overloads the Access Control table, refreshes the log, and so on.
SHUTDOWN: Turn off the MySQL service.

Special permissions:

All: Allow to do anything (as root).
USAGE: Only allow login-nothing else is allowed.

MySQL User rights detailed

Related Article

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.