LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-25-2004, 09:01 PM   #1
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Rep: Reputation: 30
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.*
 
Old 09-26-2004, 06:53 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
If you want to use a socket then you will need to configure in the [mysqld] section of /etc/my.cnf
 
Old 09-26-2004, 11:37 AM   #3
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

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

Last edited by j-ray; 09-26-2004 at 11:39 AM.
 
Old 09-26-2004, 05:30 PM   #4
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
I can connect and use mysql from bash.

I will check out my.conf

Thanks for the hints.
 
Old 09-26-2004, 07:10 PM   #5
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
I can't find my.cnf in /etc/ ?
 
Old 09-26-2004, 08:24 PM   #6
lappen
Member
 
Registered: Aug 2003
Location: Sweden
Posts: 83

Rep: Reputation: 15
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
 
Old 09-26-2004, 08:53 PM   #7
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
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;
 
Old 09-27-2004, 01:13 PM   #8
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
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
 
Old 09-27-2004, 03:42 PM   #9
lappen
Member
 
Registered: Aug 2003
Location: Sweden
Posts: 83

Rep: Reputation: 15
Just make sure mysql has write and read conditions in tmp, if you want the file there...
try setting the sticky bit on tmp
 
Old 09-27-2004, 06:22 PM   #10
stardotstar
Member
 
Registered: Nov 2002
Location: /au/qld/bne/4157
Distribution: Gentoo mactel-linux
Posts: 238

Original Poster
Rep: Reputation: 30
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
 
Old 09-27-2004, 08:14 PM   #11
lappen
Member
 
Registered: Aug 2003
Location: Sweden
Posts: 83

Rep: Reputation: 15
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

Last edited by lappen; 09-27-2004 at 08:17 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
php4 problem when upgrade MySQL-server-4.1.12-1 dev_mohamed Linux - Software 1 06-22-2005 02:58 PM
Apache / Php4 / Trustix problem. xconspirisist Linux - Software 7 06-23-2004 05:49 PM
Apache / PHP4 includes problem? DevlshOne Red Hat 0 01-06-2004 09:18 PM
Strange PHP4/Apache/Opera problem corwax Linux - Software 2 09-23-2003 04:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration