MySQL Grant view User Rights command

Source: Internet
Author: User
Tags create database mysql view

Statement

The code is as follows Copy Code

Show grants for your users

Like what:

The code is as follows Copy Code

Show grants for root@ ' localhost ';

View user rights.

The code is as follows Copy Code

Show grants for your users;
Show grants for root@ ' localhost ';
Show grants for webgametest@10.3.18.158;
Show CREATE Database dbname; This will see some of the parameters used to create the database.
Show create table tickets; You can see some of the parameters that are used to create the table


View all users in the MySQL database

The code is as follows Copy Code
Mysql>select DISTINCT CONCAT (' User: ', user, ' @ ', ', host, '; ') as query from Mysql.user;
+---------------------------------------+
| Query |
+---------------------------------------+
|                User:; |
|              User:; |
|                      User:; |
|                     User:; |
|                    User:; |
|                   User:; |
|             User:; |
|           User:; |
|       User:; |
|  User:; |
|       User:; |
|                 User:; |
|            User:; |
|        User:; |
|              User:; |
|          User:; |
|         User:; |
|             User:; |
|           User:; |
|     User:; |
| User:; |
+---------------------------------------+
Rows in Set (0.01 sec)



To view the permissions of a specific user in a database

The code is as follows Copy Code
Mysql> Show grants for;
+-------------------------------------------------------------------------------------------------------------- -----+
| Grants for |
+-------------------------------------------------------------------------------------------------------------- -----+
| GRANT PROCESS, SUPER on *.* to identified by PASSWORD ' *daff917b80e3314b1abecba9df8785afd342ce89 ' |
| GRANT all privileges in ' cacti '. * to |
+-------------------------------------------------------------------------------------------------------------- -----+
2 rows in Set (0.00 sec)

Mysql> SELECT * from Mysql.user where user= ' Cactiuser ' G
1. Row ***************************
Host:%
User:cactiuser
Password: *daff917b80e3314b1abecba9df8785afd342ce89
Select_priv:n
Insert_priv:n
Update_priv:n
Delete_priv:n
Create_priv:n
Drop_priv:n
Reload_priv:n
Shutdown_priv:n
Process_priv:y
File_priv:n
Grant_priv:n
References_priv:n
Index_priv:n
Alter_priv:n
Show_db_priv:n
Super_priv:y
Create_tmp_table_priv:n
Lock_tables_priv:n
Execute_priv:n
Repl_slave_priv:n
Repl_client_priv:n
Create_view_priv:n
Show_view_priv:n
Create_routine_priv:n
Alter_routine_priv:n
Create_user_priv:n
Event_priv:n
Trigger_priv:n
Ssl_type:
Ssl_cipher:
X509_issuer:
X509_subject:
max_questions:0
max_updates:0
max_connections:0
max_user_connections:0

Not only grants can view user rights, you can also grant MySQL user rights to create, modify, delete MySQL data table structure permissions OH

Grant creates, modifies, and deletes MySQL data table structure permissions.

The code is as follows Copy Code

Grant create on testdb.* to developer@ ' 192.168.0.% ';
Grant alter on testdb.* to developer@ ' 192.168.0.% ';
Grant drop on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL foreign key permissions.

The code is as follows Copy Code

Grant references on testdb.* to developer@ ' 192.168.0.% ';

Grant operates the MySQL temporary table permission.

The code is as follows Copy Code

Grant create temporary tables on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL indexing permissions.

Grant index on testdb.* to developer@ ' 192.168.0.% ';

Grant operates the MySQL view and views the view source code permissions.

The code is as follows Copy Code

Grant CREATE view on testdb.* to developer@ ' 192.168.0.% ';
Grant Show view on testdb.* to developer@ ' 192.168.0.% ';

Grant operates MySQL stored procedures, function permissions.

  code is as follows copy code

Grant Create routine on testdb.* to developer@ ' 192.168.0.% '; -now, can show procedure status
Grant alter  Routi NE on testdb.* to developer@ ' 192.168.0.% '; -now, can drop a procedure
Grant execute     ;    on testdb.* to developer@ ' 192.168.0.% ';

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.