Mysql trying to connect to someone else's domain?



I just got a VPS and bought a cheap domain

I put my website from another provider, and brought it over to this one.

Issue is, when I try to connect to mysql through PHP I get

Access denied for user ‘user’@’[Unknown]’ (using password: YES)
(It doesn’t say unknown – i can see it; Its actually someone else’s domain I’ve never heard of and to protect their identity i didn’t show it)

Thing is, I’ve never even heard of that domain, never mind tried to connect to it. When connecting i use

new mysqli(“mysql.[MY DOMAIN]”, $username, $password, $dbname)

Of course i know my username and password are correct. I have double, and triple checked. I can log in manually through my browser, and through an SSH terminal

My best guess is the domain never propagated. So I checked it. I pinged the site from the host, from my computer, and even checked 3rd party sites – all say it has been properly propagated. And it have been almost 5hrs since I set all this up

Google doesn’t return a lot of results. my best guess is when MySQL does its reverse DNS look up, the copy on the server is out of date – but I have a VPS so there’s nothing I can do about that.

At this point i’m ready to pull my hair out; has anyone else had any issues like this?

Edit: Also worth noting: The Domain mysql is trying to connect to also actually exists; but I don’t associate with it in anyway.


You should be able to see/create your databases in the Control Panel (Advanced > MySQL DB):


Yes I know. I’ve created the DB, and have logged into it from several locations so i know the mysql.[DOMAIN] I setup works. It’s just when my PHP script does it, it tries to connect to an entirely different domain.

For example, lets say my domain was
I would do

new mysqli(“mysql.testdomain[dot]com”, “user”, $password, $dbname)

Well, when I try that I get the error

Access denied for user ‘user’@’unrelateddomain[dot]com’ (using password: YES)

I have never even heard of the 2nd domain – so why is my PHP script trying to connect to something entirely different?

edit: The host name. The MySQL host name is the thing i’m having issues with. Everything else works – the MySQL host name points to another site when I try to run it through PHP and only PHP. I can connect to MySQL through the hostname everywhere else – except when a PHP file in run on the server. The server can connect to mysql through that hostname though


Some thoughts:

  • Do you have more than one mysqli function?
  • Are you sure you’re editing the right file? (Yes, I’ve done that.)
  • Have you checked your site for malware?
  • Does another user have write access to your site?



  1. This one connection method is the only one that fails and that’s just because it exits after it fails

  2. I have not edited any files. This site is a clone

  3. Malware of not this issue is not explained

  4. No, but that also doesn’t explain the issue


I contacted their support and they basically told me not their problem. Nothing to do with them.

I tried searching everything to no avail. Gave up for a few weeks. Told the guy i’m doing this for ‘Sorry; It’s Dreamhosts fault. Nothing I can do’

Decided to take another look at it today, and it just started working. I of course have not touched a thing, nor has anyone else.

Any poor soul experiencing this:

Contact your provider; It’s almost certainly an issue on there end. Wait a few days for proper propagation.

The issue had to have been on their end and was fixed after a blazing fast 4 weeks. I of course have no idea on specifics


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.