Mysql Connection Failed

Suddenly getting

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

Google results v confusing

Can anyone help please?
smudgemouseAsked:
Who is Participating?
 
Pushpakumara MahagamageConnect With a Mentor VPCommented:
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';
0
 
David FavorConnect With a Mentor Linux/LXD/WordPress/Hosting SavantCommented:
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.
0
 
smudgemouseAuthor Commented:
Thanks for your help. Went for a time machine restore; suspecred a colleague had installed anorthr version of mysql.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.