help with mysql connect error

help with mysql connect error

am 08.02.2007 17:27:49 von Tim McGeary

--------------080907030207060709020502
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I am new to this list today, so if I should be sending this to another
specific PHP list, please let me know.

I am getting the following error via the PHP web page I am building:

> Warning: mysql_connect(): Can't connect to local MySQL server through
> socket '/var/lib/mysql/mysql.sock' (13) in
> /var/www/html/software/index.php on line 18 Can't connect to local
> MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Here are lines 12-19 in my index.php file in which I am trying to
establish a mysql connection:

> > $hostname = "localhost";
> $username = "softread";
> $password = "XXXXXXX"; // XXXX'd out for list only
> $dbname = "software";
>
> mysql_connect($hostname, $username, $password) or die(mysql_error());
> mysql_select_db($dbname) or die(mysql_error());

I am running this on a RH ES 3.0, using PHP 4.3.2, and MySQL 5.0.27. I
CAN connect to MySQL via the following commands:

> # mysql -usoftread -p software
AND
> # mysql --socket=/var/lib/mysql/mysql.sock -usoftread -pXXXXXX software

I can also connect to the MySQL database via the web using webmin. And
here are the php.ini configurations for MySQL:

> mysql.allow_persistent = On
> mysql.max_persistent = -1
> mysql.max_links = -1
> mysql.default_port = 3306
> mysql.default_socket =
> mysql.default_host = localhost
> mysql.default_user =
> mysql.default_password =
> mysql.connect_timeout = -1
> mysql.trace_mode = Off

From googling the error message and reading the suggestions of others,
I think I've covered all of my bases. What else do I need to look at
that could be causing this problem? I've had a person who is used to
configuring servers to use PHP and MySQL look at this and he also thinks
I've got it setup correctly. Help!

Thanks,
Tim



--------------080907030207060709020502
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------080907030207060709020502--

Re: help with mysql connect error

am 08.02.2007 17:45:57 von Tim McGeary

--------------080601000908070608050508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stut wrote:
> Tim McGeary wrote:
>> I am new to this list today, so if I should be sending this to another
>> specific PHP list, please let me know.
>>
>> I am getting the following error via the PHP web page I am building:
>>
>>> Warning: mysql_connect(): Can't connect to local MySQL server through
>>> socket '/var/lib/mysql/mysql.sock' (13) in
>>> /var/www/html/software/index.php on line 18 Can't connect to local
>>> MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
>
> Given that you can connect through the socket on the CLI, I'm gonna
> guess that it's a permissions issue. Does the user that Apache (or
> whatever web server you're using) runs as have access to mysql.sock?
>

Currently mysql.sock is owned by mysql.mysql with S777 permissions.
Should the ownership be different? Despite the ownership, wouldn't S777
allow any user to access it?

Tim




--------------080601000908070608050508
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------080601000908070608050508--

Re: help with mysql connect error

am 08.02.2007 17:46:44 von Stut

Tim McGeary wrote:
> I am new to this list today, so if I should be sending this to another
> specific PHP list, please let me know.
>
> I am getting the following error via the PHP web page I am building:
>
>> Warning: mysql_connect(): Can't connect to local MySQL server through
>> socket '/var/lib/mysql/mysql.sock' (13) in
>> /var/www/html/software/index.php on line 18 Can't connect to local
>> MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Given that you can connect through the socket on the CLI, I'm gonna
guess that it's a permissions issue. Does the user that Apache (or
whatever web server you're using) runs as have access to mysql.sock?

-Stut

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: help with mysql connect error

am 25.03.2007 21:10:42 von Haydar TUNA

Hello,
Firstly download the PHP 5.X source tar.gz package and then install
the PHP 5.X --with-mysql=DIR parameter (DIR is the mysql 5 installation
directory). If you try to use this method, your problem will be fixed. I
think you installed the mysql 5 and PHP 4 together with --with-mysql PHP
installation parameters. You didn't use --with-mysql=DIR parameter. For this
reason, PHP 4 support mysql 3.X and mysql 4.X connection.:)

"Tim McGeary" , haber iletisinde sunlari
yazdi:45CB4F85.9070600@lehigh.edu...
>I am new to this list today, so if I should be sending this to another
> specific PHP list, please let me know.
>
> I am getting the following error via the PHP web page I am building:
>
>> Warning: mysql_connect(): Can't connect to local MySQL server through
>> socket '/var/lib/mysql/mysql.sock' (13) in
>> /var/www/html/software/index.php on line 18 Can't connect to local
>> MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
>
> Here are lines 12-19 in my index.php file in which I am trying to
> establish a mysql connection:
>
>> >> $hostname = "localhost";
>> $username = "softread";
>> $password = "XXXXXXX"; // XXXX'd out for list only
>> $dbname = "software";
>>
>> mysql_connect($hostname, $username, $password) or die(mysql_error());
>> mysql_select_db($dbname) or die(mysql_error());
>
> I am running this on a RH ES 3.0, using PHP 4.3.2, and MySQL 5.0.27. I
> CAN connect to MySQL via the following commands:
>
>> # mysql -usoftread -p software
> AND
>> # mysql --socket=/var/lib/mysql/mysql.sock -usoftread -pXXXXXX software
>
> I can also connect to the MySQL database via the web using webmin. And
> here are the php.ini configurations for MySQL:
>
>> mysql.allow_persistent = On
>> mysql.max_persistent = -1
>> mysql.max_links = -1
>> mysql.default_port = 3306
>> mysql.default_socket =
>> mysql.default_host = localhost
>> mysql.default_user =
>> mysql.default_password =
>> mysql.connect_timeout = -1
>> mysql.trace_mode = Off
>
> From googling the error message and reading the suggestions of others,
> I think I've covered all of my bases. What else do I need to look at
> that could be causing this problem? I've had a person who is used to
> configuring servers to use PHP and MySQL look at this and he also thinks
> I've got it setup correctly. Help!
>
> Thanks,
> Tim
>
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php