2

I was trying to install MySQL 5.6.15 to my computer and got this error:

unable to update security settings. access denied for user 'root'@'localhost' (using password yes)

I guess current root password is wrong but I do not remember what it was. So how can I fix this problem?

1
  • Welcome do dba.SE! This guide on how to format posts may be of interest. (You can find it by clicking the question mark top right while editing.) Dec 24, 2013 at 15:07

2 Answers 2

1

If you installed MySQL 5.6 from the command line, the easiest way to find the temporary password is to go to the Linux command line do the following:

cd
cat `ls -la | grep mysql | grep secret | awk '{print $9}'` | awk '{print $18}'

This will quickly print the temporary password.

Try to login using that password

cd
OLDPASSFILE=`ls -la | grep mysql | grep secret | awk '{print $9}'`
PASSWORD=`cat ${OLDPASSFILE} | awk '{print $18}'
mysql -uroot -p${PASSWORD}

If the temporary password is no longer available, then you will have do the following:

NEWPASS="whateveriwant"
service mysql stop
service mysql start --skip-grant-tables
mysql -ANe"update mysql.user set password=PASSWORD('${NEWPASS}') where user='root'"
service mysql restart

Give it a Try !!!

0

From https://stackoverflow.com/questions/15929831/unable-to-update-security-settings-access-denied-for-user-rootlocalhost-u :

The prior install screen had asked for the Current root password. But this was the first MySQL install on the machine.

Answer: when asked for the Current root password, leave that field blank. Then the server installed ok.

4
  • I left that current root password field blank but only the error changed. "Unable to update security settings. Access denied for user 'root'@'localhost' (using password: NO)".
    – Ownur
    Dec 24, 2013 at 14:01
  • It means you have to remove mysql and installed it again
    – Hackerman
    Dec 24, 2013 at 14:04
  • In that case you'll have to reset your existing password using one of the many answers for that on here, or perhaps just wipe your MySQL data directory on this machine if you don't need it. Dec 24, 2013 at 14:04
  • No need to reinstall. See Rolando's comment below re: "skip-grant-tables." Apr 27, 2014 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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