mysql_secure_installation: ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)

Firstly, if you are not using SSL for all your sites, you should step it up! NameCheap's SSL certificates start at only $9. There's no excuse!
Firstly, if you have not tried Digital Ocean's SSD Virtual Servers for only $5/mo, I highly recommend them!

Getting this error when trying to run mysql_secure_installation even though you are entering the correct password?

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

This can happen if you have a hash or something weird in your password (it’s a bug). Time to change it! I like to do it this way so it doesn’t leave my password in my command history:

mysql -u root -p
use mysql;
update user set password=PASSWORD("something-cool") where user='root';
flush privileges;

About this entry

Good Reads