Can"t Connect to MySQL local Server

Can"t Connect to MySQL local Server

am 26.10.2006 16:35:43 von ROGER DEBRY

Janet and Miles, Thank you for your suggestions.

Here is more information for you.
I am running:
Fedora core 5 Linux
php 5.14
apache 2.2.2
mysql 5.0.22

I have added the mysql_error code to my script as you suggested.
I already knew the what the error was by looking in the error logs.
It is, "Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)"

I have run phpinfo, and it appears that MYSQL is enabled.
The MYSQL_SOCKET line in phpinfo( ) gives the path to the socket file
exactly as above.
I have checked and the socket is there with read and execute
permissions for everyone.
I did try to connect using 127.0.0.1 and got a similar error message,
"Can't connect to MySQL server on '127.0.0.1' (13)"

I can connect to the server just fine at the command line with the
mysql client,
using the command >mysql -hlocalhost -u -p

The socket declaration in my.cnf is /var/lib/mysql/mysql.sock so it
matches
what php expects.

What other suggestions can you give to me?
Thank you.

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

Re: Can"t Connect to MySQL local Server

am 26.10.2006 17:48:42 von Steven Cruz

I had a similar problem the other day I think. plus many permission
problems. But I got it work.

I added these two lines to the bottom of my /etc/my.cnf file

[client]
socket=/usr/local/mysql/mysql.sock

Just put in the path to your sock file and see if that helps.


ROGER DEBRY wrote:

>Janet and Miles, Thank you for your suggestions.
>
>Here is more information for you.
>I am running:
> Fedora core 5 Linux
> php 5.14
> apache 2.2.2
> mysql 5.0.22
>
>I have added the mysql_error code to my script as you suggested.
>I already knew the what the error was by looking in the error logs.
>It is, "Can't connect to local MySQL server through socket
>'/var/lib/mysql/mysql.sock' (13)"
>
>I have run phpinfo, and it appears that MYSQL is enabled.
>The MYSQL_SOCKET line in phpinfo( ) gives the path to the socket file
>exactly as above.
>I have checked and the socket is there with read and execute
>permissions for everyone.
>I did try to connect using 127.0.0.1 and got a similar error message,
> "Can't connect to MySQL server on '127.0.0.1' (13)"
>
>I can connect to the server just fine at the command line with the
>mysql client,
>using the command >mysql -hlocalhost -u -p
>
>The socket declaration in my.cnf is /var/lib/mysql/mysql.sock so it
>matches
>what php expects.
>
>What other suggestions can you give to me?
>Thank you.
>
>
>

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

Re: Can"t Connect to MySQL local Server

am 27.10.2006 01:33:10 von Chris

ROGER DEBRY wrote:
> Janet and Miles, Thank you for your suggestions.
>
> Here is more information for you.
> I am running:
> Fedora core 5 Linux
> php 5.14
> apache 2.2.2
> mysql 5.0.22
>
> I have added the mysql_error code to my script as you suggested.
> I already knew the what the error was by looking in the error logs.
> It is, "Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13)"

That means 'permission denied'.

Are you sure mysql is running on "localhost" ?

FC5 has "selinux" doesn't it - make sure permissions are set up properly
for that too.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: Can"t Connect to MySQL local Server

am 27.10.2006 16:01:30 von ROGER DEBRY

> Here is more information for you.
> I am running:
> Fedora core 5 Linux
> php 5.14
> apache 2.2.2
> mysql 5.0.22
>
> I have added the mysql_error code to my script as you suggested.
> I already knew the what the error was by looking in the error logs.
> It is, "Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13)"

That means 'permission denied'.

Are you sure mysql is running on "localhost" ?
Yes, I am sure.

FC5 has "selinux" doesn't it - make sure permissions are set up
properly
for that too.
hmmmm . . . Other than I know that it is there, I don't know much
about selinux.
How do I set permissions for it?

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

Re: Can"t Connect to MySQL local Server

am 27.10.2006 16:36:02 von ROGER DEBRY

Some further information/questions on this problem.

I wrote a small program just to see if I could connect to the mysql
socket, and I could.
Looking at seliunx policy, I note an item called "Allow HTTPD scripts
to and modules to connect to the network."
That item is unchecked. Should it be checked in order for the php
script to connect using a socket?

>>> "Chris" 10/26/2006 5:33 PM >>>
ROGER DEBRY wrote:
> Janet and Miles, Thank you for your suggestions.
>
> Here is more information for you.
> I am running:
> Fedora core 5 Linux
> php 5.14
> apache 2.2.2
> mysql 5.0.22
>
> I have added the mysql_error code to my script as you suggested.
> I already knew the what the error was by looking in the error logs.
> It is, "Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13)"

That means 'permission denied'.

Are you sure mysql is running on "localhost" ?

FC5 has "selinux" doesn't it - make sure permissions are set up
properly
for that too.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: Can"t Connect to MySQL local Server

am 27.10.2006 17:15:48 von Matteo Cisilino

Alle 16:36, venerd=EC 27 ottobre 2006, ROGER DEBRY ha scritto:
check if your mysql daemon doesn't skip networking


> Some further information/questions on this problem.
>
> I wrote a small program just to see if I could connect to the mysql
> socket, and I could.
> Looking at seliunx policy, I note an item called "Allow HTTPD scripts
> to and modules to connect to the network."
> That item is unchecked. Should it be checked in order for the php
> script to connect using a socket?
>
> >>> "Chris" 10/26/2006 5:33 PM >>>
>
> ROGER DEBRY wrote:
> > Janet and Miles, Thank you for your suggestions.
> >
> > Here is more information for you.
> > I am running:
> > Fedora core 5 Linux
> > php 5.14
> > apache 2.2.2
> > mysql 5.0.22
> >
> > I have added the mysql_error code to my script as you suggested.
> > I already knew the what the error was by looking in the error logs.
> > It is, "Can't connect to local MySQL server through socket
> > '/var/lib/mysql/mysql.sock' (13)"
>
> That means 'permission denied'.
>
> Are you sure mysql is running on "localhost" ?
>
> FC5 has "selinux" doesn't it - make sure permissions are set up
> properly
> for that too.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/

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

Re: Can"t Connect to MySQL local Server

am 27.10.2006 18:42:42 von ROGER DEBRY

skip-networking is uncommented in the [mysqld] section of my.cnf

I did discover something interesting this morning.=20
When starting the MySQL server with mysqld_safe,=20
I cannot connect to the server with my php script.=20
However, I started the server this morning with /etc/init.d/mysqld =
start,=20
and the php script connects just fine.=20
Can anyone tell me why the difference?

>>> "Matteo Cisilino" 10/27/2006 9:15 AM >>>
Alle 16:36, venerd=EC 27 ottobre 2006, ROGER DEBRY ha scritto:
check if your mysql daemon doesn't skip networking


> Some further information/questions on this problem.
>
> I wrote a small program just to see if I could connect to the mysql
> socket, and I could.
> Looking at seliunx policy, I note an item called "Allow HTTPD scripts
> to and modules to connect to the network."
> That item is unchecked. Should it be checked in order for the php
> script to connect using a socket?
>
> >>> "Chris" 10/26/2006 5:33 PM >>>
>
> ROGER DEBRY wrote:
> > Janet and Miles, Thank you for your suggestions.
> >
> > Here is more information for you.
> > I am running:
> > Fedora core 5 Linux
> > php 5.14
> > apache 2.2.2
> > mysql 5.0.22
> >
> > I have added the mysql_error code to my script as you suggested.
> > I already knew the what the error was by looking in the error logs.
> > It is, "Can't connect to local MySQL server through socket
> > '/var/lib/mysql/mysql.sock' (13)"
>
> That means 'permission denied'.
>
> Are you sure mysql is running on "localhost" ?
>
> FC5 has "selinux" doesn't it - make sure permissions are set up
> properly
> for that too.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/=20

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

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

Re: Can"t Connect to MySQL local Server

am 30.10.2006 00:34:46 von Chris

ROGER DEBRY wrote:
> skip-networking is uncommented in the [mysqld] section of my.cnf
>
> I did discover something interesting this morning.
> When starting the MySQL server with mysqld_safe,
> I cannot connect to the server with my php script.
> However, I started the server this morning with /etc/init.d/mysqld start,
> and the php script connects just fine.
> Can anyone tell me why the difference?

Permissions on the socket file most likely.

Skip-Networking should be uncommented (that is you only connect via
sockets) unless you specifically need remote network connections.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: Can"t Connect to MySQL local Server

am 30.10.2006 14:38:24 von ROGER DEBRY

The permissions on the socket are rwxrwxrwx -- I don't see how that
could be the problem.

>>> "Chris" 10/29/2006 4:34 PM >>>
ROGER DEBRY wrote:
> skip-networking is uncommented in the [mysqld] section of my.cnf
>
> I did discover something interesting this morning.
> When starting the MySQL server with mysqld_safe,
> I cannot connect to the server with my php script.
> However, I started the server this morning with /etc/init.d/mysqld
start,
> and the php script connects just fine.
> Can anyone tell me why the difference?

Permissions on the socket file most likely.

Skip-Networking should be uncommented (that is you only connect via
sockets) unless you specifically need remote network connections.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Re: Can"t Connect to MySQL local Server

am 30.10.2006 22:28:39 von Chris

ROGER DEBRY wrote:
> The permissions on the socket are rwxrwxrwx -- I don't see how that
> could be the problem.

But who owns the file? It should be owned by 'mysql', not 'root'.

If you want to know what the init.d file runs, add:

set -x

after

#!/bin/bash
or #!/bin/sh

whatever the first line might be.

That will print out the commands that the file is running.

>>>> "Chris" 10/29/2006 4:34 PM >>>
> ROGER DEBRY wrote:
>> skip-networking is uncommented in the [mysqld] section of my.cnf
>>
>> I did discover something interesting this morning.
>> When starting the MySQL server with mysqld_safe,
>> I cannot connect to the server with my php script.
>> However, I started the server this morning with /etc/init.d/mysqld
> start,
>> and the php script connects just fine.
>> Can anyone tell me why the difference?
>
> Permissions on the socket file most likely.
>
> Skip-Networking should be uncommented (that is you only connect via
> sockets) unless you specifically need remote network connections.
>


--
Postgresql & php tutorials
http://www.designmagick.com/

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