maynor Posted December 5, 2006 Share Posted December 5, 2006 I'm posting this question again with more detail in the hopes someone can point me in the right direction.Here's the error message:[color=blue]Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /hsphere/local/home/negliaba/negliaballet.org/index.php on line 18Could not connect : Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)[/color]My script works fine on the development platform but simply won't connect on the production server. The database and passwords are correct. Mysql is running properly as far as I can tell. (I can connect to this MySql server through Mysql Administrator, remotely.)What is it I'm missing?Here's the script:[color=blue]<html> <head> <title>Neglia PHP Test Page</title> </head><body><?error_reporting(E_ALL);ini_set(display_errors, 1);$username="neglia_xxx";$password="neglia_xxx";$database="neglia_xxx";$db = mysql_connect("localhost", $username, $password) or die("Could not connect : " . mysql_error());echo "Connected successfully";mysql_select_db($database) or die("Could not select database"); $result = mysql_query("SELECT * FROM users",$db); while ($myrow = mysql_fetch_row($result)) { printf("User Name: %s<br>\n", $myrow[1]); printf("Password: %s<br><br>\n", $myrow[2]); }?><p> Any data showing above? </p></body></html>[/color]Thanks to all for your help! Link to comment https://forums.phpfreaks.com/topic/29539-connection-error-redux/ Share on other sites More sharing options...
Orio Posted December 5, 2006 Share Posted December 5, 2006 Accroding to your error, "localhost" is not your mysql server.Orio. Link to comment https://forums.phpfreaks.com/topic/29539-connection-error-redux/#findComment-135538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.