MySQL Connect


#1

Hi. I have signed up to the Crazy Domain Insane deal, and I have set up a MySQL database. For some reason my PHP doesn’t want to connect to the database.

My php connection code is pretty standard, using mysql_connect().

Any help?


#2

Also, to elaborate, here is the error I get:

Warning: mysql_connect(): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) in /home/.emerson/uiv2/uiv2.com/forums/includes/page_header.php on line 370


#3

That error indicates that your PHP page is attempting to connect to a database server running on the local host through a Unix socket.

MySQL databases at Dreamhost are hosted on separate machines to the web server. You need to connect using a server name, username and password, e.g:

$db = mysql_connect(‘mysql.uiv2.com’, ‘username’, ‘password’);

Replace mysql.uiv2.com with the hostname you setup for your database in the panel.


#4

I thought I already did that. Turns out i forgot about a second connection I made in the same script.

I plan to get rid of this connection now, I don’t need 2. Thanks alot :smiley: