0

I have error like this

$mysql -u root -h 127.0.0.1 -P 3306 -pXXXXXXXXXXXXX

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

now I checked the grants.

mysql>  SHOW GRANTS FOR CURRENT_USER();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@%                                                                                                                                                                                                                                                                                                                                                                                                |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, LOAD FROM S3, SELECT INTO S3, INVOKE LAMBDA, INVOKE SAGEMAKER, INVOKE COMPREHEND ON *.* TO 'root'@'%' WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

It shows 'root'@'%' has privilige

Why does it happen??

or how can I fix it??

whitebear
  • 11,200
  • 24
  • 114
  • 237
  • Do you also have an entry for `root@localhost`? If so, the more specific host will take preference.You should be able to delete it and then `root@%` should work. This [answer](https://serverfault.com/q/122472/466339) on [sf] might help you, even though its quite old. – Tangentially Perpendicular Feb 19 '21 at 03:27
  • Please search this site for that exact error message. This question has been asked (and answered) many times before. – Ken White Feb 19 '21 at 03:27
  • Thank you for your help. maybe I misunderstood my basic thought. I need to recheck whole problem – whitebear Feb 19 '21 at 03:29
  • Does this answer your question? [MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)](https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw) – Tangentially Perpendicular Feb 19 '21 at 03:53

0 Answers0