MySQL ERROR 1045 (28000): Access denied for user 'db_user_name'@'localhost'

Posted: 2015-06-11 22:08:14

I have software that requires direct access to the MySQL database. If I run it on the same computer as WAMP it works, but if I access the database with this software from another computer, it then reports error:

MySQL ERROR 1045 (28000): Access denied for user 'db_user_name'@'localhost' (using password: YES)

Create the same database user (i.e., with the same name + password as the existing user) in MySQL (via \phpmyadmin), except set the “Host:” field to either the connecting remote IP address, or to “%” (which means any IP can connect).

This way you’ll be able to use this user to access the database from 127.0.0.1 (Host:127.0.0.1), and also from an outside system (Host:%).

Also make sure that you have already:

And that this database user has all permissions granted on the specific database(s), and the outside application is using the proper: IP, database name, user name, user password – to establish the connection.

If you have the mysql client on the remote system, you can also manually test this from the command-line via:

mysql -u db_user_name -p -h ip.address.here -P 3306

Accessing MySQL or phpMyAdmin From Outside