Report this

What is the reason for this report?

Unable to secure MySQL on fresh LEMP droplet

Posted on October 20, 2018

When ssh into the droplet as root, I am able to just type mysql and launch MySQL anonymously.

I then exited, and ran mysql_secure_installation, and followed all the prompts to remove the anonymous user, and set a root password.

I then stopped mysql using /etc/init.d/mysql stop and started it back up again /etc/init.d/mysql start

I then typed mysql again, and was still able to have full access to mysql anonymously as the root OS user. I expected to be denied access.

Keeping mysql running, I ran mysql_secure_installation again, and was NOT prompted to enter my current password.

Stopping mysql and then running mysql_secure_installation, I WAS prompted to enter my current password, but because the service had been stopped, it was not able to do anything.

What am I doing wrong?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Running the mysql command alone as root sources the file /root/.my.cnf, which might contain the actual login/password. So check inside that file for possible credentials.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.