I know that this is probably really simple, but it is not working for me. I am trying to run a simple connection script (see below) to the mysql database that is set up at the company that is hosting our web site and I keep getting the following message.

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/www/htdocs/eloveworldwide/connect3.php on line 2
MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Here is the .php file that I am using.

<?php
mysql_connect("localhost", "eloveworldwide","zagloff") or
die($php_errormsg);

print "Connected successfully";

mysql_select_db("eloveworldwide") or
die ("Could not select database")

?>

    You most likely need to start mysql....

    Run:

    ./mysqld start:

    Sometimes found here if mysql is on a linux box....

    /etc/rc.d/init.d/

    Hope this helps....

      Thanks. I figured out the problem. I needed to list the server where the database was stored instead of "localhost".

      Thanks for the reply.

        Write a Reply...