MySQL Forums
Forum List  »  PHP

php and mysql connect problems
Posted by: Stefan Hayden
Date: April 22, 2005 08:50PM

using this code

//set the conections
define('DB_USER', 'sthayden');
define('DB_PASSWORD', 'PASSWORD');
define('DB_HOST', 'metrocss.stefanhayden.com');
define('DB_NAME', 'metrocss');

//make the connection then select the database
$dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);


if (!$dbc) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

mysql_select_db(DB_NAME);


I get this error: Could not connect: Lost connection to MySQL server during query

if I take out the mysql_error() I get this error message: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


any help would be amazing
Stefan

Options: ReplyQuote


Subject
Written By
Posted
php and mysql connect problems
April 22, 2005 08:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.