473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

can't connect

(also posted to alt.php.sql and comp.databases.mysql)

This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.

The problem is that from my index.php file I get:

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
is running. It shows it there (size 0, as it should be). Furthermore, I
can connect from command line and can do mysql commands. The mysql is on
the same machine as the web server, so I use localhost as the host. php is
running on the server as well. The ini file shows the default location of
be empty, so it should default to the installation default of
/var/lib/mysql/, and it does since it shows up with an ls.

One post suggested changing ownership and group to mysql. I did that, but
in reality that is how was originally anyhow.

So, I am stumped. Are there any suggestions?

Shelly

Jan 18 '06 #1
5 3451
On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
(also posted to alt.php.sql and comp.databases.mysql)

This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.

The problem is that from my index.php file I get:

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
is running. It shows it there (size 0, as it should be). Furthermore, I
can connect from command line and can do mysql commands. The mysql is on
the same machine as the web server, so I use localhost as the host. php is
running on the server as well. The ini file shows the default location of
be empty, so it should default to the installation default of
/var/lib/mysql/, and it does since it shows up with an ls.

One post suggested changing ownership and group to mysql. I did that, but
in reality that is how was originally anyhow.

So, I am stumped. Are there any suggestions?

Shelly


What relevant entries do you have in php.ini? Dos it redefine the socket
to use?

There are off my test server, which works fine...

Client API version 4.1.14
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient
Jan 18 '06 #2

"Steve" <Th*****@Aint.Valid> wrote in message
news:pa****************************@Aint.Valid...
On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
(also posted to alt.php.sql and comp.databases.mysql)

This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.

The problem is that from my index.php file I get:

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the
daemon
is running. It shows it there (size 0, as it should be). Furthermore, I
can connect from command line and can do mysql commands. The mysql is on
the same machine as the web server, so I use localhost as the host. php
is
running on the server as well. The ini file shows the default location
of
be empty, so it should default to the installation default of
/var/lib/mysql/, and it does since it shows up with an ls.

One post suggested changing ownership and group to mysql. I did that,
but
in reality that is how was originally anyhow.

So, I am stumped. Are there any suggestions?

Shelly


What relevant entries do you have in php.ini? Dos it redefine the socket
to use?

There are off my test server, which works fine...

Client API version 4.1.14
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient


There are no MYSQL entries in php.ini. There are several mysql entries, but
none of those. The mysql_default_socket is empty, which should take it to
/var/lib/mysql -- which is where I found it.

Shelly
Jan 18 '06 #3

"Shelly" <sh************@asap-consult.com> wrote in message
news:sp********************@comcast.com...

"Steve" <Th*****@Aint.Valid> wrote in message
news:pa****************************@Aint.Valid...
On Tue, 17 Jan 2006 22:24:54 -0500, Shelly wrote:
(also posted to alt.php.sql and comp.databases.mysql)

This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.

The problem is that from my index.php file I get:

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the
daemon
is running. It shows it there (size 0, as it should be). Furthermore,
I
can connect from command line and can do mysql commands. The mysql is
on
the same machine as the web server, so I use localhost as the host. php
is
running on the server as well. The ini file shows the default location
of
be empty, so it should default to the installation default of
/var/lib/mysql/, and it does since it shows up with an ls.

One post suggested changing ownership and group to mysql. I did that,
but
in reality that is how was originally anyhow.

So, I am stumped. Are there any suggestions?

Shelly


What relevant entries do you have in php.ini? Dos it redefine the socket
to use?

There are off my test server, which works fine...

Client API version 4.1.14
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient


From phpinfo() I get:

mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.58
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient
Jan 18 '06 #4
Shelly wrote:
(also posted to alt.php.sql and comp.databases.mysql)

This is an old problem. I extensively researched the postings on the
internet and have found no solution. So, perhaps someone here can help.

The problem is that from my index.php file I get:

Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon
is running. It shows it there (size 0, as it should be). Furthermore, I
can connect from command line and can do mysql commands. The mysql is on
the same machine as the web server, so I use localhost as the host. php is
running on the server as well. The ini file shows the default location of
be empty, so it should default to the installation default of
/var/lib/mysql/, and it does since it shows up with an ls.

One post suggested changing ownership and group to mysql. I did that, but
in reality that is how was originally anyhow.

So, I am stumped. Are there any suggestions?

Shelly

I don't know if you've already checked this, but you mention changing
ownership and group but not permissions.

Your web server will be running as a certain user. For example, apache
runs as user 'nobody' unless you change it. Are your permissions open
enough to allow user nobody to use the socket file?

It should probably have full read/write/execute permissions for user,
group and world.

-david-

Jan 18 '06 #5
Solution: The problem was in SELinux. It was too restrictive.

Jan 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jordy | last post by:
Environment: Sun servers running solaris 2.8 Php 4.3.6 Apache 1.3.29 Mysql 4.1.1 phpMyAdmin 2.6.0-alpha1 phpAds 2.0 PhpMyadmin and phpAds don't succeed to connect the MySql database when
0
by: Ryan Stewart | last post by:
I'm running MySQL server on a WinXP box at home. I have a cable modem/router. I've set up port forwarding on port 3306 to the machine running MySQL. I can connect locally just fine, but when I try...
3
by: Pugi! | last post by:
On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get the following problem when connecting to mysql through a browser (phpMyAdmin): : #2002 Can't connect to local MySQL...
2
by: xiuchuanli | last post by:
I install Fedora 4 with web server, after that I installed mysql 5.0.15. Now I can connect to mysql from command line and mysql-administrator and mysql-query-browser. But when I try to test to...
0
by: xiuchuanli | last post by:
I install Fedora 4 with web server, after that I installed mysql 5.0.15. Now I can connect to mysql from command line and mysql-administrator and mysql-query-browser. But when I try to test to...
3
by: dmcquay | last post by:
Hi, I am setting up MySQL on a development box. I have set it up and can connect from localhost, but I cannot connect from another computer on the network. I have narrowed down the problem...
0
by: Clodoaldo Pinto | last post by:
Can't connect to postgresql server php error log message: PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: could not connect to server: Permission denied\n\tIs the server...
4
by: d3vkit | last post by:
Okay so I am at a loss here. I have a website that I've previously had no trouble connecting to the mysql DB on. I have an include to a connect file with the relevant connection info, and it was...
5
by: scorpionbilli | last post by:
Hi, The local mysql server is running on my Macbook. I can access it through the console client: $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL...
1
by: sasimca007 | last post by:
Hi friends, I installed mysql in ubuntu but, i don't know how to connect to that mysql. Actually we connect to postgresql by psql command, but when i tried to connect mysql with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.