MySQL Connect

MySQL Connect

Posted by: omegaseraph
Posted on: 2005-08-04 11:39:00

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.

[img]http://uiv2.com/storage/db.png[/img]

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

Any help?

<img src="http://66.98.160.13/~ultimais/styles/all/images/Signature.jpg" />Edited by omegaseraph on 08/04/05 11:40 AM (server time).

Re: MySQL Connect

Posted by: omegaseraph
Posted on: 2005-08-04 11:51:00

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

<img src="http://66.98.160.13/~ultimais/styles/all/images/Signature.jpg" />

Re: MySQL Connect

Posted by: psross
Posted on: 2005-08-04 12:21:00

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.

Re: MySQL Connect

Posted by: omegaseraph
Posted on: 2005-08-04 12:29:00

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 :D

<img src="http://66.98.160.13/~ultimais/styles/all/images/Signature.jpg" />

Tags: mysql databaseimgpngstoragereasondomainhttphelp