Mysql Connection Failed

smudgemouse
smudgemouse used Ask the Experts™
on
Suddenly getting

Access denied for user root@localhost (using password: Yes)

Google results v confusing

Can anyone help please?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Set reset root password - https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Grant privileges --- https://stackoverflow.com/questions/5016505/mysql-grant-all-privileges-on-database

sample grant sql -

grant all privileges on mydb.* to myuser@localhost identified by 'mypasswd';

Grant all privileges to all Database to root SQL

grant all privileges on *.* to root@localhost identified by 'mypasswd';
David FavorFractional CTO
Distinguished Expert 2018
Commented:
Please state your Distro name + how you installed MySQL (package manager or source build).

With this info, likely someone can assist you.

The info Pushpakumara provided will work, so long as you shutdown mysql + restart it with --skip-grants, as you can't change grants... if mysql is running with grants on + you have no root password.

To reset root password, mysql must be running without grants.

And... you should probably not do this, as you can cause many other problems like breaking automatic package updates.

Please answer my first question + likely someone can assist.

Author

Commented:
Thanks for your help. Went for a time machine restore; suspecred a colleague had installed anorthr version of mysql.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial