Problem with secure MySQL installation on new droplet

January 9, 2014 4.6k views
Hi, I just spun up a new droplet with a pre-config Ubuntu LAMP stack, then logged in as root fine. Changed root passwd and ran the following. apt-get update mysql_install_db mysql_secure_installation After entering the root password I get the following message: Enter current password for root (enter for none): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) This has never happened before on any droplet I have created and used. Any pointers much appreciated. Thanks in advance.
4 Answers
OK, managed to get in by doing the following:

mysql -u debian-sys-maint -p

update user set password=password('yourpassword') where user='root';
flush privileges;

Still not sure why there was a problem originally. Is this an issue with droplet creation script at DO end?
Just in case anyone else is getting the same issue debian-sys-maint password can be found by issuing this command:

cat /etc/mysql/debian.cnf
Hmm, maybe I installed my LAMP stack manually before, but never once had this error message. Thx for the pointer though.
Have another answer? Share your knowledge.