So basically this is what I did:

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=PASSWORD("~)<iXyyj<w!,s!\yZ%]YN#m;d") where User='root';
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

And now I can't access using that password. What did I do wrong? maybe the password isn't supposed to have special characters or something?

PS: centos 6.5

  • What version of mysql? As a wild guess, try this to log in: *C451CBEFADBDA21A0BA18DCDAE886B3A422EA0C4 – Russell Uhl Aug 1 '14 at 20:46
  • @RussellUhl That won't work. That's just the password hash. – RolandoMySQLDBA Aug 1 '14 at 20:47
  • @RolandoMySQLDBA: I'm fully aware of that. I just provided it on the off chance something went screwy internally – Russell Uhl Aug 1 '14 at 20:48

You may have to do the following

service mysql restart --skip-grant-tables --skip-networking
SQL="update mysql.user SET password=PASSWORD('${NEWROOTPASSWORD}') WHERE user='root';"
mysql -ANe"${SQL}"
service mysql restart
mysql -uroot -p${NEWROOTPASSWORD}

If you get the mysql prompt, CONGRATULATIONS !!!

Then, go change the password properly. Don't use the exclamation point or semicolon for a password as they mean something to Linux.

MySQL Documentation for this situation: http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html

Give it a Try !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.