Reply to Re: Cannot get mysql_connect to work

Your name:

Reply:


Posted by David Haynes on 12/28/05 03:16

Michael wrote:
> Hi,
>
> I'm trying to do something which should be very simple - connect to the
> MySQL database. Here is the call, followed by the error msg.
>
> $conn = mysql_connect("localhost", "root", "");
>
> Warning: mysql_connect(): Can't connect to local MySQL server through
> socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/buildhw.php on
> line 13
> failed
>
> I've also tried this with the host arg as "", but I get the same
> result. Logging on as root made no difference either.
>
> Any help would be very much appreciated.
>
> Thanks,
> M. McDonnell
>

You may want to adjust your php.ini for mysql.
Look for [MySQL] and then the lines like this:

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

I suspect your mysql has been compiled not to have the socket file in
/tmp/mysql.sock. In fact, it appears to be in /var/lib/mysql/mysql.sock.
A quick check of /etc/my.cnf will tell you where it should be.

-david-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация