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 ‘’;