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

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:

  • Re-bound MySQL from IP 127.0.0.1 to 0.0.0.0
  • Opened incoming port 3306 requests in Windows Firewall (and removed any existing blocking MySQL rules).
  • Port-forwarded port 3306 in the Router from WAN:3306 to LAN-IP:3306 (if accessing from outside the LAN).

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

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>