Link to home
Start Free TrialLog in
Avatar of lgeering
lgeering

asked on

MYSQL Troubles

OK, I have a Red hat 9 box with apache 2.0.47 php 4.3.2 and MySQL 3.23.57-max.  Mysql works fine using things like mysqladmin at the bash prompt, I can log in create tables, delete data etc.  I installed phpMyAdmin 2.3.3pl1 and this works fine it connects to mysql server and lists all DB's and can create/change them as needed.  The problem happens with 2 things I have found so far PHP-BB and squidalyser.  Both of these use mysql DB's to store data I have used PHP-BB before so am pretty sure is nothing i'm doing wrong with the setup of that.  The intresting thing is this squidalyser comes with a perl script that puts log data into the mysql database and this is run via cron.  The script runs fine connects to the DB and puts all the log data in it.  However when I run the web perl script from the cgi-bin dir it fails and the httpd log prints

[Sat Sep 13 12:01:57 2003] [error] [client 81.86.184.2] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) at /usr/local/apache2/cgi-bin/squidalyser.pl line 514.

Help! I have checked the location of the socket file in /etc/my.cnf and its the correct place I have also checked the socket file is being created and it is.  I have checked the mysqld log and no errors. What going on?
ASKER CERTIFIED SOLUTION
Avatar of jlevie
jlevie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lgeering
lgeering

ASKER

I see where your going, i'll check the permissions table but if this is the case then how come phpmyadmin works?(which is written in PHP)
As what user does apache run? Does that user/group have permission to access '/var/lib/mysql/mysql.sock'  ?

A.
Thanks for your input aleshm your right but jlevie beat ya to it.  The problem was like you both suggested down to permissions on the /var/lib/mysql/mysql.sock when the script was running in the shell via cron it was running as the user mysql.  Apache runs with the user nobody which couldn't read the mysql.sock file. I'm still confused why phpmyadmin worked even though it couldn't read mysql.sock (or at least I assume it couldnt as it runs through apache)but the problem is solved thanks for ya help.
You're welcome! :-)
I just added a comment... it ain't about who gets the answers, is about finding a solution to the problems... atleast this is how I look at it from my point of view...

A.