我怎么知道MySQL用户拥有最大权限?

时间:2013-07-04 07:20:06

标签: mysql root

一点背景:前段时间我用“我”替换了我的“root”用户,但忘了给“我”访问“mysql”表。今晚我用“--skip-grant-tables”运行“安全”模式,这有助于我再次获得访问权限:

UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='me';

但是,我想知道这是否能给予“我”最大的特权?我只是想确保“我”拥有完全访问权限。我不想在一年后发现这个用户缺少一些我在危机中需要的超级大国。

这尤其令我挠头:

mysql> grant all on *.* to me@localhost with grant option;
Query OK, 0 rows affected (0.11 sec)

0行是否受到影响,因为“我”已经拥有所有权限,或者我做错了什么?

3 个答案:

答案 0 :(得分:3)

试试这个:

SELECT * FROM `information_schema`.`SCHEMA_PRIVILEGES`;

SELECT * FROM `information_schema`.`USER_PRIVILEGES`;

更改用户的root用户...

SELECT Host,    Select_priv,    Insert_priv,    Update_priv,    Delete_priv     FROM mysql.user WHERE USER = "root";
SELECT Host,    Create_priv,    Drop_priv,  Reload_priv,    Shutdown_priv   FROM mysql.user WHERE USER = "root";
SELECT Host,    Process_priv,   File_priv,  Grant_priv,     References_priv FROM mysql.user WHERE USER = "root";
SELECT Host,    Index_priv, Alter_priv, Show_db_priv,   Super_priv  FROM mysql.user WHERE USER = "root";
SELECT Host,    Create_tmp_table_priv,  Lock_tables_priv,   Execute_priv    FROM mysql.user WHERE USER = "root";
SELECT Host,    Repl_slave_priv,    Repl_client_priv,   Create_view_priv    FROM mysql.user WHERE USER = "root";
SELECT Host,    Show_view_priv,     Create_routine_priv,    Alter_routine_priv  FROM mysql.user WHERE USER = "root";
SELECT Host,    Create_user_priv,   Event_priv,         Trigger_priv,   Create_tablespace_priv  FROM mysql.user WHERE USER = "root";
SELECT Host,        ssl_type    , ssl_cipher    , x509_issuer,  x509_subject,   max_questions           FROM mysql.user WHERE USER = "root";
SELECT Host, max_updates, max_connections,      max_user_connections        FROM mysql.user WHERE USER = "root";
SELECT Host, plugin, authentication_string  FROM mysql.user WHERE USER = "root";

答案 1 :(得分:1)

这里还有一些很好的信息:

show grants;

https://serverfault.com/questions/386903/mysql-grant-option

例如“为了能够对另一个用户或新用户进行GRANT ALL,发出GRANT ALL的用户必须自己拥有所有权限,否则授权将失败。”

答案 2 :(得分:0)

只是做:

USE mysql;

SELECT * FROM `user` WHERE user = 'me' AND host = 'localhost';

如果你看到所有Y而没有N你已经满了:D