您好,欢迎访问一九零五行业门户网

两种MySQL查询用户权限的方法

介绍两种查看mysql用户权限的两种方法
1、 使用mysql grants命令
mysql> show grants for username@localhost;+---------------------------------------------------------------------+| grants for root@localhost |+---------------------------------------------------------------------+| grant all privileges on *.* to 'root'@'localhost' with grant option |+---------------------------------------------------------------------+
需要注意的是:
● username和ip的组合需要是在mysql.user表中存在的,具体可以通过 select * from mysql.user 命令查看
● ip地址如果是通配符格式需要加引号,例如:show grants for root@'172.%';
推荐:《mysql教程》
2、 使用mysql select命令
mysql> select * from mysql.user where user='root' and host='localhost' \g;*************************** 1. row *************************** host: localhost user: root password: ********************** select_priv: y insert_priv: y update_priv: y delete_priv: y create_priv: y drop_priv: y reload_priv: y shutdown_priv: y process_priv: y file_priv: y grant_priv: y references_priv: y index_priv: y alter_priv: y show_db_priv: y super_priv: y create_tmp_table_priv: y lock_tables_priv: y execute_priv: y repl_slave_priv: y repl_client_priv: y create_view_priv: y show_view_priv: y create_routine_priv: y alter_routine_priv: y create_user_priv: y event_priv: y trigger_priv: ycreate_tablespace_priv: y ssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0 max_updates: 0 max_connections: 0 max_user_connections: 0 plugin: mysql_native_password authentication_string: password_expired: n1 row in set (0.01 sec)
更多编程相关内容,请关注编程入门栏目!
以上就是两种mysql查询用户权限的方法的详细内容。
其它类似信息

推荐信息