Forum Moderators: coopster

Message Too Old, No Replies

mySQL connection

I am getting a connection error everytime I try to establish a connection

         

amdorsey

8:23 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



I am using the following basic script to test mySQL connection...

<?php

$server = "localhost";
$user = "example@example.com";
$pass = "password";

$connection = mysql_connect($server,$user,$pass)
or die(mysql_error());

print("Congratulations! You connected to MySQL");

?>

Any thoughts?

[edited by: jatar_k at 5:44 pm (utc) on Mar. 23, 2004]
[edit reason] generalized [/edit]

coopster

9:22 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Is the mysql server started? What is the error you are receiving?

Side Note:
MySQL usernames [mysql.com] can be up to 16 characters long.

amdorsey

10:01 pm on Mar 22, 2004 (gmt 0)

10+ Year Member



The error is...

Warning: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/newsite/guide/index.php on line 7

I am running PHP myAdmin to create, modify and delete tables within mySQL database, wouldn't that mean that mySQL is running fine?

AprilS

2:48 am on Mar 23, 2004 (gmt 0)

10+ Year Member



have you tried supplying just the IP address as apposed to "localhost"?

Also, I don't use MysqlAdmin as I do everything from command line, but check your "mysql" database. The "user" table should have a "localhost" host specified for your user "example@example.com" user - if not, that user will not be allowed to connect from the local machine.

[edited by: jatar_k at 5:44 pm (utc) on Mar. 23, 2004]
[edit reason] generalized [/edit]