Jump to content

Connection Error redux.


maynor

Recommended Posts

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 18
Could 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.