4

一点背景知识:不久前,我用“me”替换了“root”用户,但忘记让“me”访问“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行是否因为“我”已经拥有所有权限而受到影响,还是我做错了什么?

4

3 回答 3

4

试试这个:

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";
于 2013-12-07T01:16:45.773 回答
2

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

show grants;

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

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

于 2013-07-04T08:08:54.883 回答
-1

做就是了:

USE mysql;

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

如果你看到所有但Y没有N你有完整的:D

于 2013-07-04T07:25:49.873 回答