-1

I am running mysql 5.6 and tried to change the root password following these instructions: https://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html

I followed the generic instructions at the bottom of the page titled: B.5.3.2.3 Resetting the Root Password: Generic Instructions

I skipped stopping the server and executing the FLUSH PRIVILEGES command. I executed the following command though:mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

However, now when I try to log in I receive this error message:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Does anyone know where I went wrong?

Thank-you for reading this.

UPDATE:I found this post helpful - how to log in to mysql and query the database from linux terminal

One of the answers works for me where specifying the password directly after the -p instead of waiting for the password prompt. Something maybe wrong with my operating system.

Does anyone know why I can log in when putting the password like so: mysql -uroot -pMypassword but not like so:mysql -uroot -p and then put the password in when prompted?

This whole adventure started when I changed the password... :/

Community
  • 1
  • 1
user3808269
  • 1,321
  • 3
  • 21
  • 40

1 Answers1

1

What you'll want to do is to stop the MySQL server, and start it as root with the following option:

--skip-grant-tables

Then you login as usual, entering username root and no password, update the password as you did with

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

and then

FLUSH PRIVILEGES;

After that, you should be able to login as root from the same box. If you have issues logging in from other computers, you might want to add those servers after the @ sign in the "SET PASSWORD" statement.

Nico Andrade
  • 880
  • 5
  • 16