ERROR 1045 (28000): Access denied for user 'root' @ 'localhost

Source: Internet
Author: User

ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) solve a friend's question: m 3 ysql upgraded 5.0 -- 5.5 The imported data is okay, grant all privileges on *. * to test @ '12. 12.12.12 '; ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) I initially suspected that the password is incorrect, change it to grant all privileges on *. * to test @ '12. 12.12.12 'identified by 'xxx'; it cannot be changed to grant all privileges on *. * to test @ '12. 12.12.12 'identified by'; neither

Mysql> grant all privileges on *. * to test @ '12. 12.12.12 'identified by ''; ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) however, the following command succeeds: mysql> grant select on *. * to test @ '12. 12.12.12 'identified by ''; Query OK, 0 rows affected (0.01 sec)

 

I suspect that the current root Account has permission issues and asked him to execute show grants;
[SQL] mysql> show grants; + Grants privileges + | grants for root @ localhost | + Grants privileges + | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, show databases, SUPER, create temporary tables, lock tables, EXECUTE, replication slave, replication client, create view, show view, create routine, alter routine, create user, EVENT, trigger on *. * TO 'root' @ 'localhost' with grant option | grant select, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, create temporary tables, lock tables on 'mysql '. * TO 'root' @ 'localhost' | grant proxy on ''@'' TO 'root' @ 'localhost' with grant option | + merge into rows + 3 rows in set (0.00 sec) the problem arises because the normal root account has the following permissions: [html] mysql> show grants; + PRIVILEGES + | Grants for root @ localhost | + --------------------------------------------------------------------- + | grant all privileges on *. * TO 'root' @ 'localhost' with grant option | grant proxy on ''@'' TO 'root' @ 'localhost' with grant option | + rows + 2 rows in set (0.00 sec) mysql>

 

His root account does not have all privileges, so an error is reported when others are assigned all. I asked him to reset the root account with mysqladmin.
/usr/local/mysql/bin/mysqladmin –u root password ‘’;

 

 

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.