Can't run MySQL

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Can't run MySQL

Postby erelsgl » 11. March 2008 05:58

I just installed Xampp on a new computer. When I tried to run mysql, I got the following error:

[code]
[root@localhost erelsgl]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)



[root@localhost erelsgl]# less /opt/lampp/var/mysql/localhost.err
080310 15:59:08 mysqld started
080310 15:59:08 [ERROR] Can't start server : Bind on unix socket: Permission denied
080310 15:59:08 [ERROR] Do you already have another mysqld server running on socket: /opt/lampp/var/mysql/mysql.sock ?
080310 15:59:08 [ERROR] Aborting
080310 15:59:08 [Note] /opt/lampp/sbin/mysqld: Shutdown complete
080310 15:59:08 mysqld ended



[root@localhost erelsgl]# ll /opt/lampp/var
total 16
drwxrwxrwx 6 erelsgl erelsgl 4096 2008-03-11 06:46 mysql/
drwxr-xr-x 2 erelsgl erelsgl 4096 2008-03-10 15:59 proftpd/
-rw-r--r-- 1 root root 5 2008-03-10 15:59 proftpd.pid
drwxr-xr-x 2 erelsgl erelsgl 4096 2005-05-31 14:00 run/


[root@localhost erelsgl]# ll /opt/lampp/var/mysql
total 20
drwxrwxrwx 2 erelsgl erelsgl 4096 2003-10-30 00:12 cdcol/
-rwxrwxrwx 1 nobody root 2196 2008-03-11 06:46 localhost.err*
drwxrwxrwx 2 erelsgl erelsgl 4096 2005-10-24 18:42 mysql/
drwxrwxrwx 2 erelsgl erelsgl 4096 2004-12-06 15:56 phpmyadmin/
drwxrwxrwx 2 erelsgl erelsgl 4096 2005-07-12 12:22 test/




[root@localhost erelsgl]# ps -ecf|grep mysql
root 25226 8798 TS 19 06:53 pts/2 00:00:00 grep --color mysql


As you can see, I have no other mysqld running, and no mysql.sock file. I am root and I all files and folders have all permissions.

What should I do?
erelsgl
 
Posts: 7
Joined: 03. December 2006 10:00

Postby Nobbie » 11. March 2008 13:58

>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

As you can see, the server cannot access the socket file in /var/lib/mysql/mysql.sock - what is *not* equal to /opt/lampp/var/mysql/mysql.sock

It seems, that mysql takes the wrong or no configuration file (called my.cnf).

Is there another my.cnf in /etc for example? Is there another MySQL-Installation on your server? The log-File of lampp-mysqld looks as if there is already running a mysql server.

Which Linux Distribution are you running? What is the output of "ps -fe" in a Shell? Can you find another process "mysqld" and/or another webserver ("apache2" or "httpd")?
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Postby spanish » 15. March 2008 18:11

Hello,

I have the same (or very similar) problem (Ubuntu 7.10 and XAMPP 1.6.6):

http://localhost/xampp/cds.php don't works:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2) in /opt/lampp/htdocs/xampp/cds.php on line 64

And http://localhost/phpmyadmin/ either:
#2002 - El servidor no está respondiendo (o el socket del servidor MySQL local no está configurado correctamente)

------------------------------------------

I have another my.cnf file:

Path: /etc/mysql/my.cnf

Socket configuration of this file:

[client]
socket = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english

------------------------------------------

The last logs of my "ps -fe":

root 19243 1 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19318 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19319 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19320 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19321 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19323 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19324 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 19335 19243 0 17:50 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5

------------------------------------------

What can I do?

Thanks,

Manuel
spanish
 
Posts: 8
Joined: 14. March 2008 02:19

Postby Wiedmann » 15. March 2008 18:38

spanish wrote:Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)

What can you read in the file "/opt/lampp/var/mysql/*.err"?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby spanish » 15. March 2008 19:13

Wiedmann wrote:What can you read in the file "/opt/lampp/var/mysql/*.err"?


This:

080315 17:50:42 mysqld started
080315 17:50:42 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
080315 17:50:42 [ERROR] Do you already have another mysqld server running on port: 3306 ?
080315 17:50:42 [ERROR] Aborting

080315 17:50:42 [Note] /opt/lampp/sbin/mysqld: Shutdown complete

080315 17:50:42 mysqld ended


Thanks,

Manuel
spanish
 
Posts: 8
Joined: 14. March 2008 02:19

Postby Wiedmann » 15. March 2008 20:24

080315 17:50:42 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use

I think this message is clear:
080315 17:50:42 [ERROR] Do you already have another mysqld server running on port: 3306 ?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby spanish » 01. May 2008 01:59

Hello Wiedmann,

I have changed 3306 to 3307 in /opt/lampp/etc/my.cnf and now all is ok.

Thank you very much!!!

\ ;-)

Manuel
spanish
 
Posts: 8
Joined: 14. March 2008 02:19

Re: Can't run MySQL

Postby bevege » 26. September 2010 07:20

if you have multiple mysql servers installed make sure you run the correct mysql or change your path settings. For example:

/opt/lampp/bin/mysql -u root -p

This fixed my problem. If you just run mysql it uses the my.cnf for that install not the lampp one.
bevege
 
Posts: 1
Joined: 26. September 2010 07:13


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 14 guests