No grant permissions after MySQL root privilege optimization

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.