This question already has an answer here:
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.
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
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,
(using password: YES)
or (using password: NO)
mean ?root@localhost
and root@127.0.0.1
</div>
using password: YES shows that you entered mysql password.
127.0.0.1 and localhost are same
Look like you forget to change db connection setting in wp-config.php
/** MySql database password */
define('DB_PASSWORD', 'MyNewPass');
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