Solution Error code:1044. Access denied for user ' root ' @ '% ' to database

Source: Internet
Author: User

Today, on the MySQL test cluster, you encounter a problem with permissions:

Sqlexception:sql state:42000 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:Access denied for user ' root ' @ '% ' to database ' Ranger ' errorcode:1044

I am logged in as root user MySQL, how to still encounter this problem, a bit fishy, I looked under the MySQL user table under the permissions information

Mysql> SELECT Host,user,password,grant_priv,super_priv from mysql.user;+--------------+---------+-------------- -----------------------------+------------+------------+| Host         | User    | Password                                 nbsp;| Grant_priv | Super_priv |+--------------+---------+-------------------------------------------+------------+------------+| 192.168.28.% | Oozie   | *fed29c14b2e900d70b11b1f1b370f953ba51a6a0 | N          | Y          | | 192.168.28.% | Hive    | *fed29c14b2e900d70b11b1f1b370f953ba51a6a0 | N          | Y          | | 192.168.28.% | Root    | *fed29c14b2e900d70b11b1f1b370f953ba51a6a0 | Y          | Y          | | localhost    | Ranger  | *84bb87f6bf7f61703b24ce1c9aa9c0e3f2286900 | N          | N          | | localhost    | Root    | 0                                   nbsp     | Y          | Y          | | %            | Root    | *fed29c14b2e900d70b11b1f1b370f953ba51a6a0 | Y          | Y          | | 127.0.0.1    | Root    | *fed29c14b2e900d70b11b1f1b370f953ba51a6a0 | Y          | Y          | | %            | Ranger  | *84bb87f6bf7f61703b24ce1c9aa9c0e3f2286900 | N          | Y          |+--------------+---------+-------------------------------------------+-------- ----+------------+

You can see that the authorization permission is not open: Grant_priv is set to N for [email protected]%. Repaired under

UPDATEMySQL.User SETGrant_priv=' Y ',Super_priv=' Y ' WHERE User=' Root ';FLUSH Privileges;

Log in again and it's OK. If you are unable to perform the update, stop the MySQL service first and then mysqld_safe--skip-grant-table & (This can refer to the previous article: http://blog.csdn.net/oDaiLiDong/article/details/50196661), And then start MySQL normally after you change it.


Solution Error code:1044. Access denied for user ' root ' @ '% ' to database

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.