Connecting to MySQL Databases Remotely

Been having trouble getting a database connection from XAMPP on my local machine to a database on a virtual server.

I can only get the database to work using localhost but I also want access remotely. How can I change the mySQL server to accept remote connections? I have added my local ip 192.168.0.% and my public ip to the list of remote hosts in virtualmin>Edit Databases.

what would be the host name for the MySQL Server?

mysql.mydomain.com?

or

FQDN

or

something else?

Status: 
Active

Comments

Howdy -- by default, and for security reasons, MySQL doesn't allow users to connect to the database remotely.

So, if you've already configured the database to listen for remote connections, you'd then have to go into Edit Databases, click "Remote Hosts", and add in your local machine's IP address.

Once you've done that, the actual hostname you use to access it doesn't matter, so long as it resolves to your server. You could just use "mydomain.com", or you could even use your IP address.

Ok but anytime I put anything other than localhost as the DB host in a php config file the connection with virtualmin to the database is broken and I get "Error establishing a database connection"

How can I tell virtualmin that my.domain.com used as a DB host connection should connect to my MySQL server?

Thanks for you help!