In the original database, the root user authorized the login host as%
Mysql> show grants for [email protected] "%"; +------------------------------------------------- -------------------------------------------------------------------------------+| grants for [ email protected]% |+--------------------------------------------------------------------------------------------------- -----------------------------+| grant all privileges on *.* to ' root ' @ '% ' IDENTIFIED BY PASSWORD ' *abe28a948664e6cea78541abee3a910833361f23 ' with grant option |+------------------------------------------------------------------------------------------ --------------------------------------+1 row in set (0.00 sec) mysql>
Re-add host [email protected] and [email protected] then delete [email protected] "%", flush privileges. I thought I was finished after the whole good. And then add the authorization when the embarrassing thing happened.
Mysql> Grant All on * * to [email protected] "111.74.99.66"; ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
When I give the root authority when obviously give all ah, why do not have authorization authority?
After Baidu and compared with other database root users, the final query user table root user grant_priv field found to N.
15:05:18 15:05:28 mysql> Select User,host,grant_priv from user; 15:05:28 +---------+---------------+------------+15:05:28 | user | Host | Grant_priv |15:05:28 | Root | 127.0.0.1 | N |15:05:28 | Root | localhost | N |15:05:28 +---------+---------------+------------+15:05:28 rows in Set (0.00 sec) 15:05:28 15:07:33 MySQL >
Stricken to change the root user's Grant_priv field to Y,
15:17:10 mysql> Update mysql.user set grant_priv= "Y" where user= "root" and host= "localhost"; 15:17:10 Query OK, 1 row Affected (0.00 sec) 15:17:19 mysql> flush privileges;15:17:19 Query OK, 0 rows Affected (0.00 sec) 15:17:20 mysql> Bye
Then quit logging in, then come in authorization, problem solving.
15:18:05 mysql> Grant all on mysql.* to ' root ' @ ' 111.74.99.66 '; 15:18:05 Query OK, 0 rows Affected (0.00 sec)
After authorizing all permissions, there is no grant permission for what permissions.
This article is from "Barley tea" blog, please be sure to keep this source http://damaicha.blog.51cto.com/6046098/1870607
No grant permissions after MySQL root privilege optimization