I am using PHP and MySQL to make a database connection, the only change is that I am trying to access my remote server from my local computer using my server IP address.
mysql_connect("x.xx.xx.x","username","password") or die(mysql_error());
and the error I am getting is Unable to connect to the given host
. The user has all privileges and rights.
Log in to cPanel. Under the Databases section, click on the Remote MySQL® icon. On the Remote MySQL® page, enter the connecting IP address, then click Add Host.
Using MySQL Workbench to access your remote MySQL database through an SSH tunnel is a simple and secure way to manage your databases from the comfort of your local computer.
Most default installs of MySQL only listen to the local machine.
Look for the bind-address
setting in my.cnf
on the server, and make sure it's listening on the IP address you're targetting. You may also need to ensure skip-networking
isn't switched on!
Alternatively (and less securely!) the following will set it up to listen on all addresses - local and remote:
bind-address = 0.0.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With