LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MySQL Socket problem from Apache 1.3 and Php4 (https://www.linuxquestions.org/questions/linux-software-2/mysql-socket-problem-from-apache-1-3-and-php4-235232/)

stardotstar 09-25-2004 09:01 PM

MySQL Socket problem from Apache 1.3 and Php4
 
I am trying to do some local development on my site and have set up Apache 1.3, MySQL 4 and PHP4 under Fedora.

When I try to connect to the MySQL databases (which I havew confirmed are there and working with the username and pass used) Apache comes back with :L

can;t connect to local MySQL server through socket '/tmp/mysql.sock (2)'

why is this, MySQL is showing up in phpinfo? Where do I start? There is no mysql sock in /tmp/ I am guessing it gets created on some kind of initialisation.

I have had this working on this machine before but since I have done stuff with Apache 2 and upgraded to Fedora from RH9.

There is no firewall (just a thought :?)

It could be conf for Apache 1.3 vs 2 and the version of php???

TIA

Will.*

david_ross 09-26-2004 06:53 AM

If you want to use a socket then you will need to configure in the [mysqld] section of /etc/my.cnf

j-ray 09-26-2004 11:37 AM

can u connect to mysql from bash? maybe mysqld is simply not running and u need to (re)start it.
cheers, j.

stardotstar 09-26-2004 05:30 PM

I can connect and use mysql from bash.

I will check out my.conf

Thanks for the hints.

stardotstar 09-26-2004 07:10 PM

I can't find my.cnf in /etc/ ?

lappen 09-26-2004 08:24 PM

You need to copy the default one from the mysql tarball or create one from scratch if memory serves me correct..

try adding this in my.cnf, and make sure it has read/write access to the file..

[client]
socket = /path/to/mysqld.sock

stardotstar 09-26-2004 08:53 PM

That is great, I have located my-large and my-small cnf files in my tar ball.

This is making more sense. Since my system doesn't have a global cnf I tried to use my-small.cnf as /etc/my.cnf and left the default socket listing but now get the same issue as the php/apache call:

Code:

[root@stardot support-files]# mysql -u stardotstar -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.14-standard
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> quit
Bye
[root@stardot support-files]# mv /etc/my.cnf.old /etc/my.cnf
[root@stardot support-files]# mysql -u stardotstar -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@stardot support-files]#

You can see that once the my.cnf is applied the MySQL server does not find a valid socket. What do I need to do to locate or make an appropriate socket?

TIA

Will;

j-ray 09-27-2004 01:13 PM

as far as i know the server creates the socket while starting. i would try a different directory than the /tmp but im not sure whether or not this is the point. on my box the socket resides in /var/lib/mysql. edit the my.conf to create the socket elsewhere.
maybe someone else has a better idea...
do u start mysqld thru /etc/init.d or mysqld_safe? if not try one of these options.
cheers,j

lappen 09-27-2004 03:42 PM

Just make sure mysql has write and read conditions in tmp, if you want the file there...
try setting the sticky bit on tmp

stardotstar 09-27-2004 06:22 PM

I have somehow got this untangled but still confused;

Basically I can't get MySQL to put the sock in /tmp/ I have edited php.ini to look to /var/lib/mysql/mysql.sock

So, the local php.ini variables are pointing to the right place but the Global is still saying /tmp/

I will post some details from phpinfo and some other findings later if anyone can help me untange my configs.

Thanks guys!

Will
Perseverance and forums have paid off as always :)

lappen 09-27-2004 08:14 PM

You need to restart apache for changes made in php.ini to take effect,
Make sure you have changed my.cnf to point to the same location


http://dev.mysql.com/doc/mysql/en/Pr...ysql.sock.html


All times are GMT -5. The time now is 10:45 AM.