Couldn't start MySQL! while starting XAMPP

This Worked For me as a Charm. [I used Ubuntu 12.04 and Xampp]

sudo chmod 755 /opt/lampp/etc/my.cnf

sudo chmod -R 777 /opt/lampp/var/mysql

sudo chown -hR root:root /opt/lampp

& Now Start Your Xampp


It might just be that the /opt/lampp doesn't have the right permissions. Before reinstalling everything, try running the commands below, it worked for me:

sudo /opt/lampp/lampp stop
sudo chmod 755 /opt/lampp/etc/my.cnf
sudo chmod -R 777 /opt/lampp/var/mysql
sudo chown -hR root:root /opt/lampp
sudo /opt/lampp/lampp start

Just remove the version where the MySQL is not started with the command rm -rf /opt/lampp and the command:

tar xvfz xampp-linux-1.8.1.tar.gz -C /opt

Replace xampp-linux-1.8.1.tar.gz with your file name. After restarting your lampp, it will work fine.