Question

Supplied password for mysql in one-click-lamp instance doesn't work

I’ve just setup a new one-click-lamp instance and am having trouble accessing MySQL. I’ve always used phpmyadmin to manage my databases so I installed that following the guides here. Once installed I tried to login using ‘root’ and the password supplied in the /root/.digitalocean_password file. This didn’t work right from the start.

I’ve since tried many methods on various help threads to try and reset the root password and I still can’t login. The only user I can login to phpmyadmin with is ‘phpmyadmin’ and the password is in /etc/phpmyadmin/config-db.php. This user has zero permissions though and can’t do anything.

The other weird thing(I think) is that if I run the ‘MySQL -u root -p’ in my CLI, I can use any old password or none at all and I can run MySQL commands there all I like. Is this normal?

I’m not sure what’s going on or if somehow in my various attempts to reset the root password I’ve screwed it all up. It never worked from the start though and I can’t seem to figure it out.

Any help would be appreciated. I may have to try a whole new droplet to see if this is normal.

Cheers.

Show comments

Submit an answer


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!

Sign In or Sign Up to Answer

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.

Accepted Answer

Came here just to thank gvanroyen (not the MOD, who appears to have never publicly followed up), to say THANK YOU for that tip about auth_socket. I realized too that I can do “sudo mysql -u root” but of course the supplied instructions about finding the root password in /root are misleading. Seems an update to the one-click instructions is in order…

For people searching for quick answer.

  1. Connect to your droplet
  2. copy & run command: sudo mysql -u root
  3. copy & run command: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswordhere';

After this you wont be able to connect to MySQL without password in shell.

One click instructions on MySQL, LEMP, LAMP and other where effected, should definitely be updated…

Is there a solution for this? It still does not work nearly a year later on the LEMP stack (not LAMP but probably the same issue.)

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel