I am running Ubuntu 18.04 (Server version: 5.7.28-0ubuntu0.18.04.4 (Ubuntu)) and have done a fresh mysql installation. I've used mysql_secure_installation and set a root password. However when I then go (logged in as root) mysql -u root -p and enter a blank password I am still able to login to the MySQL server. I've done flush privileges, I've tried Unable to set mysql root password and I notice a similar (but unanswered) issue here: mysql_secure_installation on Ubuntu 16.04 doesn't set the root pass.

Why would MySQL not store/save the root password? Interestingly if I try to connect as a non-root user I am not able to connect with empty OR the password.

  • Do you have a ~/.my.cnf with the credentials in it in the /root location? What if you set your root password within the mysql context? Did you restart mysql after it? – Valentin Bajrami Dec 12 '19 at 21:46

So it turns out that MySQL 5.7 now allows a user of the same name to access MySQL if the authentication type is "auth_socket". I'm personally not a fan - so the solution was found here:


| improve this answer | |

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.