LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-14-2008, 04:48 PM   #1
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Rep: Reputation: 16
xampp mysql.sock problem


i use xampp to learn php, but when i make a database with php, and open the php file, it gives errors that it can't open mysql.sock. I searched for but it's isn't somewhere on the drive.

How can i fix this? Is there a way to use a .sock file from someone else?
 
Old 03-14-2008, 05:16 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
please search this site for a million identical questions... start by scrolling down to the bottom of this page. generally you've not got mysql running.
 
Old 03-15-2008, 06:08 AM   #3
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
I have installed myqsl, but is this necessary? Mysql is already in xampp.

I started mysqld with:
Code:
root@helios:~# /etc/rc.d/rc.mysqld start
Then i run this to test if it works:

Code:
mysql@helios:~$ /usr/bin/mysqladmin ping
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
mysql@helios:~$
But as you can see, it stil doesn't work. I have searched for mysql.sock, but it doesn't exist. What do i have to do know?

I have searched mysql downloads, but none have a mysql.sock file. Is there a way to create it?
 
Old 03-15-2008, 07:00 AM   #4
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
I think xamp installs under /opt so the socket should be under that directory, it seems like your mysql client is searching under /var/lib/mysql where the normal rpm creates the socket.

When you find it edit your /etc/my.cnf and point the socket to the correct location.
 
Old 03-15-2008, 09:09 AM   #5
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
yes xampp is installed under /opt/.

But also in /opt/ there is no mysql.sock file. It doesn't exists on my harddrive.
 
Old 03-15-2008, 09:48 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
the file won't exist unless mysql is running. it disappears when it isn't running. does "pidof mysqld" show it is running?
 
Old 03-15-2008, 11:21 AM   #7
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
Am sure xamp has a my.cnf file installed, find it and see where the socket is set to then edit your /etc/my.cnf and point to the same location.
 
Old 03-15-2008, 03:27 PM   #8
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
mysqld is running:

Code:
root@helios:~# pidof mysqld
2941
i have found the mysql.sock file in /var/run/mysql, but i can't copy it:

Code:
root@helios:~# cp /var/run/mysql/mysql.sock /opt/lampp/var/mysql/
cp: cannot open `/var/run/mysql/mysql.sock' for reading: No such device or address
When i make a link to it with the -sf options, i doesn't give any errors, but still on the php file it gives these errors:

Code:
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2) in /home/frank/oosterpower/index.php on line 22
 
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/frank/oosterpower/index.php on line 22
I have noticed that after some time (or something else, i don't know) the /var/run/mysql/mysql.sock file disappears.

Why does the disappears, and why can't i copy the mysql.sock file to another location. Why does the link not work?
 
Old 03-15-2008, 03:54 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
if it disspears it must've crashed / aborted due to invalid config or some such. step outside of your problem as you've seen it, just focus on mysql, use the mysql client itself to just try to connect.
 
Old 03-22-2008, 04:16 AM   #10
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
i ran this command from reply #8 with mysql installed from the slackware pkgs:
Code:
root@helios:~# pidof mysqld
2941
But when i run it, without it installed (only via lampp), it doens't give any output.

But when i run /opt/lampp/lampp security (to set some passwords etc):
Code:
XAMPP: Quick security check...
XAMPP: Your XAMPP pages are secured by a password.
XAMPP: Do you want to change the password anyway? [no]
XAMPP: MySQL is accessable via network.
========================== This is probably important ==================================
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP: Turned off.
XAMPP: MySQL has to run before I can check the security.
XAMPP: MySQL has to run before I can check the security.
========================================================================================
XAMPP: ProFTPD has a new FTP password. Great!
XAMPP: Do you want to change the password anyway? [no]
XAMPP: Done.
Is also tried this: (after activiting lampp)
Code:
root@helios:/opt/lampp/htdocs/xampp/lang# /opt/lampp/lampp stopmysql
XAMPP: MySQL isn't running...
to test if mysql is running, but also here it says it isn't running.

Why does mysql not work?
 
Old 03-22-2008, 08:42 AM   #11
simplicissimus
Registered User
 
Registered: Mar 2008
Posts: 104

Rep: Reputation: 15
lack of permission

The MySQL socket file is created at runtime, provided that MySQL is allowed to create any file in the location defined by my.cfg.

I would check if that location is either world-writeable or at least has mysql set as user and group.

This type of socket error is usually due to the lack of permissions.

Hope this helps,
Regards,
SIMP

Fedora Development

Last edited by simplicissimus; 04-02-2008 at 05:56 AM.
 
Old 03-22-2008, 03:51 PM   #12
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
It works! It was just an permission issue.

Really thanks simplicissimus!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mohadesz Linux - Server 3 03-15-2008 06:06 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mathimca05 Linux - Newbie 2 10-17-2007 03:04 AM
mysql.sock problem jklaroe Slackware 2 06-19-2004 02:04 PM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration