Hello,

Probably a question that has been asked a million times before, I searched google and it
has been brought up before but there didn't seem to be that many solutions and alot fo the
time it would just "Start working".

Anyway,I have just set up my mysql server

Server version: 3.23.54
Protocol version: 10
Connection: Localhost via UNIX socket
UNIX socket: /var/lib/mysql/mysql.sock

and wrote a little php test script to access the database (not php is configured properly and works
when it is just plain php but as soon as it (tries to) connect to the database all fails).

<?
$connection=mysql_connect("localhost","melinda","mypasswd");
$connection= mysql_connect("localhost","melinda","mypassswd") or die("Couldn't connect");

if($connection)
{
$msg="success";
}
?>
<? echo "$msg"; ?>
The message I get when I connect is:

Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/melinda/public_html/test-sql.php on line 2
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/melinda/public_html/test-sql.php on line 2
Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/melinda/public_html/test-sql.php on line 3
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/melinda/public_html/test-sql.php on line 3
Couldn't connect


I am still trying to understand all the info on access but I did setup the user melinda as follows:

mysql> use mysql
Database changed

mysql> insert into user (host, user, password) values('localhost', 'melinda',password('mypasswd'));
- then flushed privileges

mysqladmin -u root -p flush-privileges

and I can login to mysql as the user melinda.

Is the error message above due the fact that I have not enabled some other permission or it simply due to the fact that
the socket is in /var/lib/mysql/mysql.sock not in /tmp/ and if so how do I tell it that the socket file is in /var/lib

Many Thanks,

Melinda


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to