473,800 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3466
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_TY PE 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.V alid> wrote in message
news:pa******** *************** *****@Aint.Vali d...
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_TY PE 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_s ocket 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******** ************@co mcast.com...

"Steve" <Th*****@Aint.V alid> wrote in message
news:pa******** *************** *****@Aint.Vali d...
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_TY PE 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_TY PE 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
931
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
9014
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 to connect from a remote location using: mysql -h xxx.xxx.xxx.xxx -P 3306 -u root -p mysql I get: ERROR 2003: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061) When I try:
3
17812
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 server through socket /var/lib/mysql/mysql.sock On the website of MySQL this error is mentioned but I found no solution. In /var/log/messages the following log occurs :
2
2747
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 connect from php code, it told me that "can not connect to local mysql through /tmp/mysql.sock. /tmp/mysql.sock is my sock file to connect and permission is set good. when I add phpinfo() to my php code, it show me that mysql lib php uses is 4.1.X,...
0
1829
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 connect from php code, it told me that "can not connect to local mysql through /tmp/mysql.sock. /tmp/mysql.sock is my sock file to connect and permission is set good. when I add phpinfo() to my php code, it show me that mysql lib php uses is 4.1.X,...
3
5462
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 quite a bit, but can't quite figure it out still. I am getting MySQL Error Number 2003 "Can't connect to MySQL server on 'server'. I know that the server is there because I can ping it. I am also running a webserver from that computer and I am...
0
2772
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 running on host &quot;127.0.0.1&quot; and accepting\n\tTCP/IP connections on port 5432? php connection string:
4
3771
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 working fine until today. I am trying to implement some ajax with the javascript framework mootools (although I don't see how this is causing the problem it started happening right around this time sooo...) I am sending info from my login form to the...
5
2638
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 connection id is 4 Server version: 5.0.45 MySQL Community Server (GPL)
1
8706
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 mysql command but it displaying this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when i give mysql databasename it displaying the following error: Can't connect to local MySQL...
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10251
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.