0

I have connected to a digitalocean server that hosts my website through ssh and when I use mysql -u root -p it prompts a password, however no matter what I input it lets me in.

There is a DB_PASS in the wp_config.php file. Also, I tried this: https://support.rackspace.com/how-to/mysql-resetting-a-lost-mysql-root-password/ to set a password for mysql with no success

Kenster
  • 23,465
  • 21
  • 80
  • 106
Nikko
  • 163
  • 2
  • 11
  • Welcome to the site. You may want to edit your post to put additional details like the relevant content of your configuration files. The more relevant details you post, the easier it will be for the community to help. – camba1 Jul 25 '19 at 15:03
  • 1
    Maybe your MySQL has been started with `skip-grant-tables` set. I would check this with your hosting Company. Its difficult to tell if a instance has been started with skip-grant-tables set – RiggsFolly Jul 25 '19 at 15:11
  • What happens if you try `mysql -h localhost -u root` ? Check that the column `password` in table `user` in database `mysql` does not contain empty cells. – IVO GELOV Jul 25 '19 at 17:19
  • When checking with vi, the cell for authentication_string for localhost root is empty. – Nikko Aug 01 '19 at 11:35

1 Answers1

0

If there's no authentication_string for root user.

Please try following command to to configure the root account to authenticate with a password:

mysql -u root -e "UPDATE mysql.user SET authentication_string = '' WHERE user = 'root';"
mysql -u root -e "UPDATE mysql.user SET plugin = '' WHERE user = 'root';"
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'ROOT_PASSWORD_HERE';"
FLUSH PRIVILEGES;
Eric
  • 732
  • 4
  • 13
  • "ERROR 1133 (42000): Can't find any matching row in the user table" - that's what I get when I run the third line – Nikko Aug 01 '19 at 11:25
  • Similar to this [case](https://stackoverflow.com/questions/12877458/mysql-error-1133-cant-find-any-matching-row-in-the-user-table), try `FLUSH PRIVILEGES;` see if it helps – Eric Aug 01 '19 at 13:09
  • by the way, if mysql version <5.7.5 or Mariadb version <10.2, please try using this command `mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('ROOT_PASSWORD_HERE');"` instead the ALTER one – Eric Aug 01 '19 at 13:12