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

September 19, 2018 1.7k views
MySQL LAMP Stack

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.

2 comments
  • Hey friend! I’m waiting to talk to our the master of one-click images on this side to understand a couple of things, but I am looking at this with intent to follow up. Just wanted to let you know it isn’t being ignored.

  • Hey. Thanks for the follow up. Last night I spun up a new plain Ubuntu 18.04 instance and installed Apache, MySQL and PHP from scratch. Again I ran into the same issue where I couldn’t access MySQL using the root user and a password. Only this morning when I ran through this specific guide https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04 did I realise that the root user is set to only connect via ‘authsocket’ instead of 'mysqlnativepassword’. I’m not sure if this is a recent default on newer versions of MySQL or what but when you don’t realise that this is set, everything else can be really hard to figure out. It’s especially hard because when you connect via ssh to your instance for the first time, the message explicitly tells you that your root password is stored at ’/root/.digitaloceanpassword’. So naturally you’d assume this would work. Kinda tricky. I may have missed something somewhere that explains this but yeah, not sure if it could be clearer.

    Thanks.

    by Mark Drake
    phpMyAdmin is an application that allows users to interact with MySQL databases through a web interface. This tutorial covers the process of installing and securing phpMyAdmin on an Ubuntu 18.04 server.
2 Answers
willyboyd February 5, 2019
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…

Same happens to me with LEMP 1-click app.

Have another answer? Share your knowledge.