Connecting to a Remote MySQL database on my VPS


New Member
Hi all, I need some help trying to connect to a mysql db on my VPS.

I'm running a Counter-Strike server here at my house, and I want to stream statistics from that server to my db on my vps.

The perl script that streams the stats, has a config file:

dbtype = mysql
dbhost = mydomain
dbport =
dbname = mydb
dbuser = mydbuser
dbpass = mydbpw
dbtblprefix = ps_

I've tried the dbhost field as my domain name, and ip address, and for dbport I've put in 3306.

I get the error:

Error connecting to database using dsn "DBI:mysql:database=mydb;;port=3306":
Host '' is not allowed to connect to this MySQL server

It's as if if my home IP address isn't allowed to connect remotely. And I did check to see that the DBI:mysql perl module is installed.

Do mysql databases on the Linux VPS plan allow for remote connections? Searching through the forums I thought it looked like it, and that's where I saw to use port 3306.

Running the same perl script on my VPS itself, I get a different error:

Access denied for user 'mydbuser'@'localhost' (using password: NO) - I'm not sure where to fix that one yet, it should be using my password.

Any suggestions?

I do not have an exact answer. But in cPanel, there is an option "Remote MySQL" where you can add remote hosts that can access the MySQL database. If you got cPanel, you can check on that.

Hopefully someone else can give you a proper solution, or you can submit a ticket and see if support can help on this.
mylinear was on the right path with the answer he provided above - what's happening is that you're being blocked out by a built in security measure to prevent hackers or unauthorized access to your databases. You'll have to add you're IP (or the IP of the server trying to connect to your VPS) to the list of hosts allowed to access MySQL on your VPS. You can do this from within' cPanel or WHM.

Within cPanel:
- Click on "Remote MySQL" and then add the IP address.

Within' WHM:
- Click "Additional MySQL Access Hosts"
- Add the IP Address in the text area
- Read the IMPORTANT note at the bottom of that page
- Save your changes

Hope this helps,
- Devon
Thanks - can't believe I missed the Remote MySQL option in Cpanel.

Still not working though, I think it has something to do with not using the password. I'm not sure why the DBI::mysql perl module isn't using the password.

Trying to run the perl script remotely or on my VPS, I get:


Access denied for user 'user'@'Access denied for user 'mydbuser'@'' (using password: NO)
(using password: NO)

(In the Remote setup, I added *, * and the IP address)

(On the VPS server:)

Access denied for user 'mydbuser'@'localhost' (using password: NO)
I'd be careful opening your MySQL database to allow connections from domains such as *; Comcast is one of the largest ISP's within the US and therefore means you're creating a pretty big security risk by doing so. I'd only allow specific IP Addresses if I were you.

- Devon
Hi friend,

If you are looking for Connecting to a Remote MySQL database on my VPS.
Then I have to explain you.
Check here - How to connecting to a Remote MySQL database on my VPS

I think this link helps you to connecting MySql database.

Thank You.