Two ways to view user permissions in MySQL

Source: Internet
Author: User

Http://yanue.net/post-96.html

Two ways to view the user Rights command in MySQL:

one. Using MySQL grants

For more information on MySQL Grant, see: Http://yanue.net/post-97.html How to use:

  
    
   
  1. Mysql> Show grants for [email protected];
Instance:
  
    
   
  1. Mysql> Show grants for [email protected];
  2. +---------------------------------------------------------------------+
  3. | Grants for [email protected] |
  4. +---------------------------------------------------------------------+
  5. | GRANT all privileges on * * to ' root ' @ ' localhost ' with GRANT OPTION |
  6. +---------------------------------------------------------------------+
  7. 1 row in Set (0.01 sec)
two. Directly through the MySQL select query statement:
   
  
  1. Mysql> SELECT * from Mysql.user where user= ' test ' and host= ' 127.0.0.1 ' \g;
  2. 1. Row ***************************
  3. host:127.0.0.1
  4. User:test
  5. Password: *eb3c643405d7f53bd4bf7fba98dcf5641e228833
  6. Select_priv:n
  7. Insert_priv:n
  8. Update_priv:n
  9. Delete_priv:n
  10. Create_priv:n
  11. Drop_priv:n
  12. Reload_priv:n
  13. Shutdown_priv:n
  14. Process_priv:n
  15. File_priv:n
  16. Grant_priv:n
  17. References_priv:n
  18. Index_priv:n
  19. Alter_priv:n
  20. Show_db_priv:n
  21. Super_priv:n
  22. Create_tmp_table_priv:n
  23. Lock_tables_priv:n
  24. Execute_priv:n
  25. Repl_slave_priv:n
  26. Repl_client_priv:n
  27. Create_view_priv:n
  28. Show_view_priv:n
  29. Create_routine_priv:n
  30. Alter_routine_priv:n
  31. Create_user_priv:n
  32. Event_priv:n
  33. Trigger_priv:n
  34. Create_tablespace_priv:n
  35. Ssl_type:
  36. Ssl_cipher:
  37. X509_issuer:
  38. X509_subject:
  39. max_questions:0
  40. max_updates:0
  41. max_connections:0
  42. max_user_connections:0
  43. Plugin:mysql_native_password
  44. Authentication_string:
  45. Password_expired:n
  46. 1 row in Set (0.00 sec)

Can see Select_priv,insert_priv,update_priv ... Equal to n means no permissions, and the user right is at a glance. Commands can be used at this time

To add permissions to a User:

See http://www.yanue.net/post-97.html

  
    
   
  1. Grant all privileges on * * to ' test ' @ ' 127.0.0.1 ' identified by ' passwd ';
  2. Flush privileges;
In addition: show can see a lot of things:
  
    
   
  1. show databases;
  2. Show tables;
  3. Show CREATE Database dbname; This allows you to see some of the parameters used to create the database.
  4. Show CREATE TABLE tablename; You can see some of the parameters used to create the table

Two ways to view user permissions in MySQL

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.