LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-28-2005, 11:46 AM   #1
basq3
LQ Newbie
 
Registered: Mar 2005
Location: baton rouge
Distribution: fedora 3
Posts: 21

Rep: Reputation: 15
Unhappy mysql php gurus please help


Re: Failed to connect to MySQL - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(13)


the mysql.sock file - when i try to pull it up in a texteditor it say its unreadable- though the permissions say read and write and its executable.

1)what exactly is in that file?
2) how can I make sure its correct?

mysql works except when interacting with an outside proggy, like php.
 
Old 03-28-2005, 12:32 PM   #2
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
Plzz provide more details!
problem occurs when accessing mysql thru php on apache?
 
Old 03-28-2005, 12:51 PM   #3
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Sounds like you're trying to access a mysql server at the localhost and thus it's using a socket instead of a network connection, but then it's failing. Please give more details. The .sock file is a socket, not a text file or anything like that-remember almost everything in linux is represented as a file.
 
Old 03-28-2005, 08:37 PM   #4
basq3
LQ Newbie
 
Registered: Mar 2005
Location: baton rouge
Distribution: fedora 3
Posts: 21

Original Poster
Rep: Reputation: 15
I'm able to connect through the command line - but when trying to access through a cms like mambo it gives me this error.

using fedora 3,

I tried what it said to try for "cant connect" @ the middle of mysql -->

http://dev.mysql.com/doc/mysql/en/ca...to-server.html

[root@localhost ~]# mysqladmin -h `hostname` version
mysqladmin: connect to server at 'localhost.localdomain' failed
error: 'Host 'localhost.localdomain' is not allowed to connect to this MySQL server'

I get that error for some of the other test. I know mysql is running:

Server version 3.23.58
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 5 days 36 min 38 sec

Threads: 1 Questions: 3654 Slow queries: 0 Opens: 370 Flush tables: 1 Open tables: 63 Queries per second avg: 0.008

[root@localhost ~]# mysqladmin -h host_ip version
mysqladmin: connect to server at 'host_ip' failed
error: 'Unknown MySQL Server Host 'host_ip' (1)'
Check that mysqld is running on host_ip and that the port is 3306.
You can check this by doing 'telnet host_ip 3306'


( yes i changed the host_ip above )
any ideas?

someone groovy made a php db connex tester and thats where im getting the error, the script is made to debug why my mambo site isnt connecting to the db.:


Code:
<?php 

$mosConfig_host     = 'WWWW';  // Replace as appropriate.
$mosConfig_db       = 'XXXX';  // Replace as appropriate.
$mosConfig_user     = 'YYYY';  // Replace as appropriate.
$mosConfig_password = 'ZZZZ';  // Replace as appropriate.


// Can we connect to the database server?
$dbh = @mysql_connect($mosConfig_host, $mosConfig_user, $mosConfig_password) 
or die('Failed to connect to MySQL.<br><b>' . mysql_error() .'</b>');

// Can we attach to our selected database?
mysql_select_db($mosConfig_db, $dbh) 
or die('Failed selecting database: ' . $mosConfig_db . '<br/><b>' 
       . mysql_error() .'</b>');

// If we get here then all is well.
echo "Connected to $mosConfig_db on $mosConfig_host successfully.";

?>
 
Old 03-29-2005, 03:50 AM   #5
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
looks like you havent configured your db settings on your cms script.
you have to put your servername, database and password instead of those xxxx and yyyy.

Last edited by evil_empire; 03-29-2005 at 03:53 AM.
 
Old 03-29-2005, 09:26 AM   #6
basq3
LQ Newbie
 
Registered: Mar 2005
Location: baton rouge
Distribution: fedora 3
Posts: 21

Original Poster
Rep: Reputation: 15
rofl- yes i tried the connector script with all the db's, username and passwords. give me some credit
 
Old 03-29-2005, 11:40 AM   #7
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
Couldn't get u there?!
You mean you really hadn't configured the db name, server and stuffs or youere just tryin to pinch me for under-estimating you.
If you were doing the later. I really didn't intend to underestimate you, you know shit happens! And I have no magical powers to read someones mind and get his/her level of skill.
cheers
 
Old 03-29-2005, 01:01 PM   #8
basq3
LQ Newbie
 
Registered: Mar 2005
Location: baton rouge
Distribution: fedora 3
Posts: 21

Original Poster
Rep: Reputation: 15
eheh no harm no foul- i had tried different dbs and usersnames that did work in the consol. the mysqlcc even works, just that php isnt connecting
 
Old 03-29-2005, 01:54 PM   #9
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
hehehe, no problem!
Well, the main point is trying to sort out the problem.
Any progress?
 
Old 03-29-2005, 09:33 PM   #10
basq3
LQ Newbie
 
Registered: Mar 2005
Location: baton rouge
Distribution: fedora 3
Posts: 21

Original Poster
Rep: Reputation: 15
unfortunatly not as of yet.

i may just scrape the box and reload a windows server if i cant get the main function to work.
 
Old 03-30-2005, 03:53 AM   #11
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
Could u paste or upload your php.ini file somewhere?
Whats the php version?
Your mysql server is local right?
 
Old 03-30-2005, 03:54 AM   #12
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
OK, I think there's still a few things you could try.
Have you logged in as root@localhost first and set up permissions in the GRANT privileges system to allow connections from another hostname or by another users?

Have you tried 127.0.0.1 instead of localhost in that script so it tries to use a network connection instead of a socket?

Have you made sure you've opened ports in your firewalls to allow a remote connection?
 
Old 03-30-2005, 04:10 AM   #13
akilles
Member
 
Registered: Sep 2004
Location: Vestfold, Norway
Distribution: Slackware
Posts: 139

Rep: Reputation: 15
I had similar error when first attempting to setup a MySQL server. I have apache, php and mysql running on the same server. My problem was that PHP was configured to use mysql, but the path in PHP's ./configure --with-mysql=[DIR] was wrong.
Pointed to a mysql folder, but that folder was just crap.
I downloaded the ready-made package: mysql-max 4.1.10
Un-tarred that to /usr/local/mysql-4.1.10 and pointed:
(PHP's) ./configure --with-mysql=/usr/local/mysql-4.1.10

After that, everything worked like a charm.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql-server4.1 and mod php-mysql conflig kernelvn *BSD 0 06-18-2005 11:52 AM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 02:54 PM
Installing MySQL.4.0.17 and php support for Mysql on RedHat 9.0 Neha Linux - Software 13 12-29-2003 12:06 AM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 08:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:39 PM.

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