Is it possible to connect to a mysql web database such as phpmyadmin while programming on my pc?


So this might be a stupid question but is there a way for me to connect to my web database while I am programming an express.js server on my home pc so that i can test and make sure my sql calls make sense and are working?

When I try to connect I get an error that says: ERROR 1044 (42000): Access denied for user



This error message means the MySQL running at the hostname mentioned in your connection request received your program’s request to connect.

That rules out network-connectivity and firewall problems. You can get to your server.

The MySQL server then refused the request because it refused your credentials. And your nodejs program complained to you with that error message.

Your account on the MySQL server has three parts:

  1. Your username,
  2. the machine from which you connect, and
  3. your password.

But when you give your credentials you only give your username and password.

You may need to create a user on your MySQL server that allows connection from other than localhost. Try something like this:

CREATE USER 'chaosdestined'@'%' IDENTIFIED BY 'my_secret_password';

This creates a user — a highly privileged root user — with the username chaosdestined that’s allowed to log in to MySQL from any host ('%', the SQL LIKE wildcard character).

MySQL’s user-authentication is weird this way. You often need two accounts, one called for example 'chaosdestined'@'localhost' and another called 'chaosdestined'@'%'

Once you have such a user, you should be able to connect to your MySQL database from any useful MySQL client (HeidiSQL for example if you’re on Windows) running on your development machine. (Get rid of this user in production lest you be overrun by cybercreeps.)

Answered By – O. Jones

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published