0

I'm using EasyPHP with MySQL 5.7.17 and after a while I got this error when trying to connect to the local MySQL server

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

Tried skip-grant-tables , and as a matter of fact it fixes the problem but I cant create a new database

How can I fix this?

Thanks in advance.

Dharman
  • 30,962
  • 25
  • 85
  • 135
SirMissAlot
  • 120
  • 2
  • 11
  • So use skip-grant-tables to get in, give `root` a password. Remove skip-grant-tables, restart MySQL. Then login using `root` and the new password – RiggsFolly Aug 08 '19 at 09:45
  • for more info check this https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw?rq=1 – RamSharma Aug 08 '19 at 09:46
  • @RiggsFolly ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement – SirMissAlot Aug 08 '19 at 10:21
  • @RiggsFolly CREATE USER xxxx@localhost IDENTIFIED BY 'password'; OR SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456'); – SirMissAlot Aug 08 '19 at 10:24
  • There are some protection mechanisms in MySQL when runnning with `skip-grant-tables` as in that mode you can do some serious damage. Fix the `root` account while running with s-g-t. Then remove that setting from `my.ini` and restart MySQL. Then when MySQL is running in normal mode you can login with `root` and create new accounts – RiggsFolly Aug 08 '19 at 10:27
  • @RiggsFolly How can i fix the `root` account ? – SirMissAlot Aug 08 '19 at 10:35
  • This [might be worth a read](https://stackoverflow.com/questions/37028695/how-to-recover-change-mysql-password/37029376#37029376) – RiggsFolly Aug 08 '19 at 10:36
  • [Or this](https://stackoverflow.com/questions/29070501/regaining-access-to-lost-mysql-password-for-phpmyadmin-on-wamp/29073563#29073563) Ignore the WAMPServer specific bits as you are not using that – RiggsFolly Aug 08 '19 at 10:38

1 Answers1

0

alter the root password

UPDATE mysql.user
    SET authentication_string = PASSWORD('passpass'), password_expired = 'N'
    WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;

Thanks RiggsFolly

SirMissAlot
  • 120
  • 2
  • 11