I've made a mess on my server. I'm using LAMPP and I've created a new user apache:apache and assigned him to take care of the Apache. phpMyAdmin did not work due to that change so I had to chown the phpmyadmin/config.inc.php to apache:apache. That worked but then I made the most stupidest thing, I chowned the whole /opt/lampp dir to apache:apache. I've installed the LAMPP inside a VM to copy all the file and dir permissions. Now I have the mysql.sock issue. It DOES exist but it won't connect.

raski@xxxxxx:~$ sudo cat /opt/lampp/etc/my.cnf |grep socket

socket = /opt/lampp/var/mysql/mysql.sock

raski@xxxxxx:~$ sudo cat /opt/lampp/etc/php.ini |grep mysql.default_socket


mysql.default_socket = /opt/lampp/var/mysql/mysql.sock

raski@xxxxxx:~$ ls -ld /opt/lampp/var/mysql/mysql.sock

srwxrwxrwx 1 mysql wheel 0 2011-07-15 12:09 /opt/lampp/var/mysql/mysql.sock

raski@xxxxxx:~$ mysql -u root -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (111)

I'd paste 'ls -lR /opt/lampp/var/mysql/' but that would be too much ;) All dbases are set to mysql:mysql which I created. I don't know who was the owner of the files before and which group they belonged to. I googled and saw everywhere mysql:mysql so I created it.

Any suggestions? Thx in advance!


Just rebuild the machine, and treat it as a learning experience in the value of proofreading your command lines before you hit "enter". At least you didn't rm -rf something crucial (like an un-backed up production database).

  • Agreed. Additionally I'd add that using LAMPP/WAMP/MAMP, or any of the other pre-packaged LAMP installer in production is craziness. They're all made for development only, and they make that clear in their documentation. Use your distribution's package management systems to install the requisite software and libraries. – EEAA Jul 15 '11 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.