dcshoeco1 Posted April 29, 2007 Share Posted April 29, 2007 I Installed a script onto my server at godaddy. I set up the mysql database correctly im pretty sure about it. Anyway im testing out my site and making changes and when I click on one of the button that says "myaccount" Im getting this message Warning: mysql_connect(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 5 Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 6 Warning: mysql_select_db(): A link to the server could not be established in /home/content/d/c/s/dcshoeco1/html/myaccount.php on line 6 Unable to connect to MySQL When I take a look at my account.php Lines 5 and 6 say this $conn=mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname) or die ("Unable to connect to MySQL"); Everything else is working fine on my site so far Im new to PHP can someone help me in fixing this. Thanks Link to comment https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/ Share on other sites More sharing options...
papaface Posted April 29, 2007 Share Posted April 29, 2007 That isn't a problem with the way you have setup your db. Its a problem with your mysql.sock file. I think you need to contact your host. Link to comment https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/#findComment-241264 Share on other sites More sharing options...
esukf Posted April 29, 2007 Share Posted April 29, 2007 From godaddy's site, you need to use the server name instead of locahost.http://help.godaddy.com/article.php?article_id=1653&topic_id=67 Link to comment https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/#findComment-241268 Share on other sites More sharing options...
dcshoeco1 Posted April 30, 2007 Author Share Posted April 30, 2007 Im stumped this is exactly what I have in my site For DBsetts.php <? $dbhost="p50mysql25.secureserver.net"; $dbname="XXXX"; $dbuser="XXXX"; $dbpass="XXXXXXX"; ?> And For My account.php I have this <tr> <td width="540" height="25" align="right" valign="middle" background="/images/modtitle-myfavs.gif"> </td> </tr> <? $conn=mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname) or die ("Unable to connect to MySQL"); // print "Connected to MySQL"; $qresult2 = mysql_query("SELECT * FROM t_favs WHERE u_id=$userID ORDER BY f_dateadded DESC"); if (!$qresult2) { die('Invalid query: ' . mysql_error()); } while ($line2 = mysql_fetch_assoc($qresult2)){ $qresult = mysql_query("SELECT * FROM t_media WHERE m_id=".$line2["m_id"]." ORDER BY m_id DESC LIMIT 1"); if (!$qresult) { die('Invalid query: ' . mysql_error()); } while ($line = mysql_fetch_assoc($qresult)){ ?> <? include("showitem.php"); ?> <? } } mysql_close($conn); ?> What do I have to change i contacted Godaddy and they were no help Link to comment https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/#findComment-241286 Share on other sites More sharing options...
esukf Posted April 30, 2007 Share Posted April 30, 2007 Can't see it from the section of script you posted but i assuming you did include DBsetts.php in your script. Try add the following to see if you get a better error on why its not connecting. <?php $conn=mysql_connect($dbhost, $dbuser, $dbpass); if (!$conn) { die('Could not connect: ' . mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/49239-php-error-message-stumped/#findComment-241289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.