mysql root用戶沒有grant權限


最近接手了幾個庫,root用戶都沒有grant權限。

1.root用戶登錄后沒有授權的權限

mysql> grant insert on mysql.abce to 'myabc'@'127.0.0.1' ;
ERROR 1142 (42000): GRANT command denied to user 'root'@'H.hostname.com' for table 'abce'

2.查看用戶的權限

mysql> show grants for root@'%';
+-------------------------------------------+
| Grants for root@%                         |
+-------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> select host,user,Grant_priv from mysql.user where user='root';
+------+------+------------+
| host | user | Grant_priv |
+------+------+------------+
| %    | root | N          |
+------+------+------------+
1 row in set (0.00 sec)

mysql> 

常規情況下,root的權限是:

mysql> show grants for root@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+

  

為了省事,修改了一下表:添加權限

mysql> update mysql.user set Grant_priv="Y" where user="root" and host="%";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM