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