Can't connect to mysql database

I am creating a new site that is currently maintained, hosted and registered by someone else. Let’s say the domain is The goal is to get the new site functional before transfering the domain to DH. However I am having trouble connecting to the mysql database from the web server.

Following DH KB advice I have created a temporary domain called and set it to mirror (on DH). A unique IP is also assigned to

I have created hostnames of:
The database of xxxx_99 is accessible under both hostnames.

I have logged into via phpMyAdmin and created the database without issue.

When I try to connect via IP or I get this error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘username’@‘’ (using password: YES) in /home/.quadrangle/username/ on line 9
Could not connect: Access denied for user ‘username’@‘’ (using password: YES)

The username and password work fine in phpMyAdmin, but not from the web server. Yes, I do have set as an allowable host in the user section.

Here is line 9 of code where the supposed error is:

mysql_connect(“”, “username”, “password”) or
die("Could not connect: " . mysql_error());

Sorry for the long post. Any suggestions?

If I understand you correctly, you are connecting to your database in DH from outside. You must grand your remote server permission to connect to this database.

You can refer this article in wiki on how to do that.

Good luck

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here

Thanks for the link, but I had already tried that fix. No joy.

I am trying to connect from within DreamHost (DH web server connecting to DH database). The web pages are on and the database is on

The error message indicates:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘username’@‘’ (using password: YES) in /home/.quadrangle/username/ on line 9
Could not connect: Access denied for user ‘username’@‘’.

That’s wierd because I am using a valid username on harpo.

I wonder if the problem is because the domain “” is currently hosted and registered elsewhere. I do have that same domain created on harpo in anticipation of the domain transfer. But I wonder if the request is being directed to the current site (outside DH) instead of the new site that is under construction on DH. Doesn’t make sense because I am simply trying to launch the index.php file via the unique IP associated with the new site on DH.

Do I need to copy all files to the temp domain of “” for testing purposes?

Any ideas for a fix or work-around?

I finally fixed my problem, so will post the solution here.

One of the error messages referenced an “Undefined variable” in the line that contained the password. So I changed the quote marks surrounding the password to apostrophes and I was able to connect to the database.

I changed:
mysql_connect(“hostname”, “username”, “password”)

mysql_connect(“hostname”, “username”, ‘password’)

I’ll admit that I’m not much of a code wrangler. Maybe someone else can explain this?

Maybe your password contained a $-sign ?

Yup… the DH generated password contained a $-sign. Like I said I’m not much a code wrangler. Any other special characters to watch out for?