1

I have a very common problem with my Ubuntu 16.04 LTS/MySQL 5.7.18/WordPress running on a Digital Ocean droplet with 2 CPU, 40GB SSD and 16GB RAM. The droplet is only running one site and has hardly any traffic because it is still under development.

  1. I cannot connect via 'mysql -u root -p'.
  2. I cannot use the 'sudo mysqlsecureinstallation' script.

Every time after entering the password I get the dreaded "Access denied for user 'root'@'localhost' (using password: YES)" error message.

This appears to be a very common problem. I wasted a whole day following all the usual recommendations, such as reinstalling MySQL, with and without prior uninstall, crossgrading to MariaDB and back to MySQL, all to none avail. What am I doing wrong?

Btw, the WordPress site is working fine. The problem only became apparent when I added Moodle to the installation and got stuck at the point where you need to create the Moodle tables. Since I cannot log into the MySQL server, I'm now stuck.

Wink
  • 11
  • 1
  • Is wordpress using a mysql connection?, if so, is it using a different user than root and how it was created? – bistoco Jun 04 '17 at 20:17
  • Wordpress is indeed using a different MySQL user. It was automatically created by Digital Ocean's one-click Ubuntu/MySQL/Wordpress installation. – Wink Jun 06 '17 at 05:29
  • Navigate into wordpress config file and check the host and port that it's using to connect to mysql. – bistoco Jun 06 '17 at 13:55

1 Answers1

0

Make sure you'v started mysql.

mysql -h 127.0.0.1 -u root

if you'v not set mysql password you should not include -p, notice you have to specify the host

Tobi Obadiah
  • 164
  • 1
  • 17
  • 1
    MySQL is running. I tried your suggestions but with the same result: Access denied for user 'root'@'localhost' – Wink Jun 06 '17 at 06:25