MYSQL Error

Status
Not open for further replies.

Turmith

New Member
Messages
10
Reaction score
0
Points
0
Working on a project with secondlife.

Essentially i contact a php page on my site and pass some parameters and the php page interfaces with a database.

Everything has been working fine for awhile now however periodically i'll get errors for hours at a time.

<b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in <b>/home/turmith/public_html/Game1.php</b> on line <b>11</b><br />
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


Then all of a sudden it'll start working correctly again, as i said Zero changes have been made to the php page or the script i'm using.

Any ideas?

Turmith Flamand
 

bugfinder

Retired
Messages
2,260
Reaction score
0
Points
0
If mysql was down that long, we'd have alarm bells going off, so that sounds strange. But at the same time, the error clearly is sure that its going to a local server.

The only other thought I can think of is its running out of sockets... but that would seem unlikely too ..
 

Turmith

New Member
Messages
10
Reaction score
0
Points
0
Here is a snippet of the code i'm using, am i doing something wrong?

--------------------------------------------
<?php


// Database Settings
define('DB_HOST','localhost'); // MySQL Server Host
define('DB_USER','******'); // MySQL User
define('DB_PASS','******'); // MySQL Password
define('DB_NAME','********'); //The name of the database

//Connect to the database or throw a nasty error
$db = mysql_connect(DB_HOST,DB_USER,DB_PASS) or die(mysql_error());
mysql_select_db(DB_NAME,$db) or die(mysql_error());
 

bugfinder

Retired
Messages
2,260
Reaction score
0
Points
0
Doesnt look wrong - are you closing connections once you're done?
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Have you checked your raw log files for more errors. Something like max "connections to mysql..." ?
 
Status
Not open for further replies.
Top