0

I am deploying a Wordpress enviroment, and there seems to happen a weird situation.

I did some tweakings and set a new root password like this

mysql -u root –p
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'MyNewPass';
service mysql restart
ufw allow 3306

then I changed the settings of bind from /etc/mysql/mysql.conf.d to from 127.0.0.1 to 0.0.0.0 so that I can access it via mySQL Workbench. Which was successful as I now am able to enter the DB from outside sources.

Once I changed the password, I altered the wp-config.php file and set the new credentials.

enter image description here

However, now, I am getting errors inside the WordPress whenever I log on, I see the following errors, despite the fact that the website runs without any issues and the articles appear.

 Failed to connect to MySQL: (1045) Access denied for user 'root'@'localhost' (using password: YES)

Below is an image of the error I am getting

enter image description here

I tried manny different scenarios on SO, and I am really sorry in advance for posting this again, but non of the solutions provided work.

Any ideas on resolving this?

And while we are at it,

  1. what does (using password: YES) or (using password: NO) mean ?
  2. What is the difference between root@localhost and root@127.0.0.1
tony9099
  • 4,567
  • 9
  • 44
  • 73

3 Answers3

1

using password: YES shows that you entered mysql password.

127.0.0.1 and localhost are same

hasbi
  • 520
  • 3
  • 10
0

Look like you forget to change db connection setting in wp-config.php

/** MySql database password */
define('DB_PASSWORD', 'MyNewPass');
Virendra Jadeja
  • 821
  • 1
  • 10
  • 20
0

using password: YES
means that you have used a password to make a connection to your server.

localhost is a hostname that means this computer and 127.0.0.1 is its IP address so they are the same.

After all here you have set a password for root user and gave it privilege to connect to the server from any host.

I think you should set your new password inside wp-config.php

EDIT:
Check your your credentials inside wp-config.php:

/** The name of the database for WordPress */
define('DB_NAME', 'your_db');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'this-is-your-password');

/** MySQL hostname */
define('DB_HOST', 'localhost'); // Exactly localhost
mahyard
  • 1,230
  • 1
  • 13
  • 34
  • @tony9099 Is the MySQL on the same machine with your website? Is it possible to connect to it via mysql -uroot -p? – mahyard Jun 22 '17 at 06:40
  • yes, they are on the same machine, and yes I can connect via mysql -u root -p – tony9099 Jun 22 '17 at 07:26
  • it is already there and still not working :/ – tony9099 Jun 22 '17 at 09:08
  • I just retested, I can login using mysql -u root -p and I do get the `mysql> ` prompt on putty, and I put the exact password in the config file, but I get that error. weird. – tony9099 Jun 22 '17 at 09:11
  • @tony9099 Can you connect with both of `mysql -u root -p -h localhost` and `mysql -u root -p -h 127.0.0.1` – mahyard Jun 22 '17 at 09:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147348/discussion-between-tony9099-and-mahyar-damavand). – tony9099 Jun 22 '17 at 09:45