« Disable annoying update manager behaviour in Ubuntu 9.04 | Home | UXTheme patches »
Solving “XAMPP: Couldn’t start MySQL!”
By admin | May 30, 2009
XAMPP for Linux is a convenient package for installing the AMPP stack (Apache, MySQL, PHP, Perl) of web server software, but it also has its own share of problems. One such error is the generic and uninformative error of “XAMPP: Couldn’t start MySQL!“. This can confuse users because it does not say anything about there error. This error is caused by permission errors because it is not able to write to a directory. Here is how to fix it.
- Open a terminal.
- Once the terminal has loaded, type “sudo chown -hR root /opt/lampp“. (Note: replace /opt/lampp with the XAMPP install director(y.
- (Update from comment #7, untested) Type “sudo chmod -R 777 /opt/lampp“.
- Restart XAMPP with “sudo /opt/lampp/lampp restart“.
- Exit the terminal (right-hand corner X or type exit).
Alternate solution for those who could not get the above working:
- Re-download the LAMPP package from http://www.apachefriends.org/. (wget http://downloads.sourceforge.net/sourceforge/xampp/xampp-linux-1.7.1.tar.gz -O /tmp/xampp-linux-1.7.1.tar.gz)
- Navigate to /opt/lampp/htdocs (or where-ever you store your documents) and back it up to another location. (mkdir /tmp/htdocs followed by cp -r /opt/lampp/htdocs/*/tmp/htdocs/)
- (optional) Also back up the configuration directory and the phpmyadmin configuration (mkdir /tmp/etc followed by cp -r /opt/lampp/etc/*/tmp/etc/ followed by cp /opt/lampp/phpmyadmin/config.inc.php /tmp/)
- Delete the entire LAMPP tree (sudo rm -rf /opt/lampp)
- Re-extract the LAMPP tree from root (tar xvfz /tmp/xampp-linux-1.7.1.tar.gz -C /opt)
- Restore htdocs folder to /opt/lampp (sudo cp -r /tmp/htdocs/* /opt/lampp/htdocs/)
- (optional) Restore configuration folder and phpmyadmin config (sudo cp -r /tmp/etc/* /opt/lampp/etc/ followed by sudo cp /tmp/config.inc.php /opt/lampp/phpmyadmin/config.inc.php)
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: HTTP (Internet), Linux | 52 Comments »

June 15th, 2009 at 5:19 pm
did not work.
June 18th, 2009 at 7:58 pm
Please be more specific - what version of XAMPP for Linux were you using? If not the latest, did you upgrade? If it did not work, what is the error returned?
June 24th, 2009 at 4:16 am
ya, it didn’t work. still show could’t start Mysql !
June 27th, 2009 at 9:52 am
Didn’t work for me either. I’m using the latest issue of Xammp on Ubuntu Jaunty
?@?-laptop:~$ sudo chown -hR root /opt/lampp
?@?-laptop:~$ sudo /opt/lampp/lampp start
Starting XAMPP for Linux 1.7.1…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Couldn’t start MySQL!
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
June 27th, 2009 at 12:04 pm
I’m also having the same problems on Ubuntu Jaunty. The solution didn’t work for me unfortunately
July 7th, 2009 at 10:43 pm
I had same problem. Was becuase I didn’t install as root. I removed lampp directory and reinstalled as root and this fixed the problem.
July 22nd, 2009 at 9:32 am
BETTER SOLUTION!!!!
Don’t do the CHOWN. It doesn’t work.
Instead,
1. Enter “Sudo Nautilus” which brings up a folder window.
2. Navigate to /opt
3. Right click on the lampp folder and select the permissions tab.
4. Enable “Create and Delete Files” Folder Access on all three levels and also “Read and Write” File Access.
5. Click on “Apply Permissions to Enclosed Files”.
6. Close the properties dialog.
You are now ready to restart Xampp per instructions above.
Good luck.
July 23rd, 2009 at 3:38 pm
Thanks, apparently worked for me!!!
August 15th, 2009 at 12:25 pm
I did work! after trying chown and chmod,
It’s because chmod changes write permissions to MySQL files and folders. Which enables you to run MySQL. thanks for the solution.
August 23rd, 2009 at 3:05 pm
great article!!!!…
September 12th, 2009 at 4:05 am
after doing chown and chmod you will get a warning as,
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
If you want to get rid of this,
1. Open a terminal and change the directory to /opt/lampp/etc
2. Type and run “sudo chmod 755 my.cnf”
Then start xampp again. You won’t get the warning message again.
-Cheers-
September 22nd, 2009 at 3:04 am
I started lampp in ubuntu 9.04 and i found the following errors:
XAMPP: Starting MySQL…
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
What could be the possible error i made?
September 27th, 2009 at 3:47 pm
@Siwalaze:
” 1. Open a terminal and change the directory to /opt/lampp/etc
2. Type and run
sudo chmod 755 my.cnf
“
October 23rd, 2009 at 8:23 pm
This solution is not relevant, I found out that I get the same error when I used the packager utility instead of the command line “tar -zxvf”, apparently, the latter maintains the required permission on the files (or maybe since I am using sudo when I am unpacking the files into /op/)
Anyway, if you just use the tar -zxvf file.tgz -C /opt/, you will not have this issue! (tested it!)
November 6th, 2009 at 1:47 pm
I have done this
”
1. Open a terminal and change the directory to /opt/lampp/etc
2. Type and run
sudo chmod 755 my.cnf
“
but still i get the error
“Wrong permissions on configuration file, should not be world writable!”
I wonder why all this errors occur!!!!!!!!!!!!!
November 8th, 2009 at 3:01 am
[...] http://www.compdigitec.com [...]
December 6th, 2009 at 6:21 am
thank
it worked
at Siwalaze:
click alt+f2 and write gksu nautilus
then go to /opt/lampp/phpmyadmin/
and click right click at config.inc.php then properties
and change the permissions to read-only
December 10th, 2009 at 5:31 am
i just chmod mysql folder :
sudo chmod -R 777 /opt/lampp/var/mysql
and it’s worked!
thx.
December 21st, 2009 at 4:55 am
Thanks to you all.It worked for me but i get some funny warning msg (Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored)
Does anyone have an idea of what this could be.
December 31st, 2009 at 9:10 am
I reinstaled with root and now is working.
January 12th, 2010 at 3:25 pm
Worked for me.
January 27th, 2010 at 11:32 am
niiiiiiiiiiiiiiiiiiiice. the chmod command in the first set of steps took care of it.
February 22nd, 2010 at 11:46 pm
worked perfectly!!
thanks
March 20th, 2010 at 7:41 am
Solved a complex issue. Thanks.
March 26th, 2010 at 4:26 am
It worked for me.
Thanks a lot for the help
April 17th, 2010 at 4:30 pm
If you guys do this to a production server, I would not recommend changing permissions to 777, and let the world have R/W access. I realized this then changed everything back to 755 (still fixed the MySQL not being able to start issue). Cheers for the fix!
April 17th, 2010 at 4:39 pm
Also, changing the owner to ‘root’ will cause errors with a lot of CMS scripts and who knows what else that is out there, the user for the Debian distro version of XAMPP is ‘nobody’.
April 17th, 2010 at 4:43 pm
SO:
sudo chown -hR nobody /opt/lampp
-and-
sudo chmod -R 755 /opt/lampp
Should do the same fix, while keeping security somewhat tight, and still allowing scripts to update necessary files and do other stuff that requires write access by the script itself.
Cheers!
May 24th, 2010 at 3:24 am
Hi, I’ve just changed
sudo chmod 755 /opt/lampp/phpmyadmin/config.inc.php
then it’s worked
May 25th, 2010 at 8:00 am
It wored for me. Thanks
June 1st, 2010 at 4:43 am
Hi, thanks for the help it worked for me this way:
1:
Since I started mysql before installing xampp:
sudo /etc/init.d/mysql stop
2:
All in the first post
3:
=================================
Kasum post:
If you want to get rid of this,
1. Open a terminal and change the directory to /opt/lampp/etc
2. Type and run “sudo chmod 755 my.cnf”
=================================
4:
sudo chmod a-w /opt/lampp/phpmyadmin/config.inc.php
from http://www.bugbase.com.ar/-post-111-phpmyadmin_wrong_permissions_on_configuration_file_should_not_be_world_writable.html
And that’s it..
August 18th, 2010 at 3:04 am
I had the same error. “XAMPP: Couldn’t start MySQL!” and, after trying the huge amount of solutions found on the net I realized that the *real* solution was under my nose, more accurate, inside the /opt/lampp/var/mysql/$HOSTNAME.err file. I read “Do you already have another mysqld server running on port: 3306 ?”. After a $ps ef | grep mysql I saw the ligth. A simple killing of the processes involved solved the problem. Hope it helps.
August 25th, 2010 at 4:15 pm
Still not working
i got the same error ..put it solve Mysql issue the i got when i trying to solve PhpmyAdmin issue
any way that what i got
Stopping XAMPP for Linux 1.7.3a…
XAMPP: Stopping Apache with SSL…
XAMPP: XAMPP-MySQL is not running.
XAMPP: Stopping ProFTPD…
XAMPP stopped.
Starting XAMPP for Linux 1.7.3a…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
Warning: World-writable config file ‘/opt/lampp/etc/my.cnf’ is ignored
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
August 26th, 2010 at 5:20 pm
Worked!!! Thanks!
August 28th, 2010 at 2:02 am
Hey Roman - you are right
By using ‘tar -zxvf’ command instead of package extracting service, this problem will not be faced.
It rocks !!!
October 9th, 2010 at 4:29 pm
It worked for me.Thanks!!
October 27th, 2010 at 6:11 am
[...] Solving “XAMPP: Couldn’t start MySQL!” at Compdigitec Labs (tags: xampp linux mysql problem solution) [...]
October 28th, 2010 at 4:03 pm
I had that problem an I SOLVED this way:
I had this error:
Starting XAMPP for Linux 1.7.1…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Couldn’t start MySQL!
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
I coudn’t start mysql cause a mysql instanse was already running.
In the terminal i did:
apt-cache show mysql-server | grep Version
and the terminal show me the mysql version
so I did:
sudo mysql
and I got the prompt: mysql>
That was I installed bacula backup which installed mysql
So I used Synaptic Package Manager to uninstall bacula and mysql (severals packages of bacula and mysql)
Thats all.
November 1st, 2010 at 3:45 am
It’s truly amazing how people STILL think that just chmod’ing everything to 777 is a fix-all for any issue. Complete and utter retard.
November 11th, 2010 at 2:12 am
thanks a lot
it really worked
January 25th, 2011 at 5:27 am
thanxs it worked
January 31st, 2011 at 5:54 am
Thanks, it works!
April 9th, 2011 at 4:23 am
GUUYYSSS.. You all rock.. It worked like charm…
April 30th, 2011 at 8:09 am
Here is my 2 cents on how to get it to work. First, (this is assuming you are using Ubuntu 10.04 or higher and have nautilus-gksu installed.) Download current version of lampp from http://www.apachefriends.org/en/xampp-linux.html#374. After download go to places-computer-filesystem-and left click and open opt file as administrator. Drag the downloaded .tar lampp file into your opt file and extract it there. After file has been extracted, delete the .tar file. Now try to start lampp in a terminal by /opt/lampp/lampp start and now you should have no problem with permissions and mysql should work.
April 30th, 2011 at 8:29 am
Addendum: My above comment assumes you do not have lampp already installed on your computer. If you do have it installed, go to places-computer-filesystem- and open opt file as administrator using (Nautilus-gksu) and delete lampp folder. Then reboot computer and follow the rest of my instructions above from there. Remember, with apache and linux, often you must reboot computer for changes to take effect. Cheers!
May 24th, 2011 at 5:30 pm
Had the same problem, Can not start MySQL.
Re-extracting files using tar -xvzf ***xampp_file*** instead of file roller fixed
June 10th, 2011 at 3:09 am
yeah tar -xvzf …… worked fine
November 22nd, 2011 at 4:47 pm
Cierto!!!!!!!!!!!
Debemos usar el comando tar xvfz xampp-linux-1.7.7.tar.gz -C /opt para instalarlo ESA ES LA SOLUCION AL PROBLEMA (NO desde la ventana con el clic redecho, extraer)…. Me quebré la cabeza buscando una solución y fue tan simple
December 8th, 2011 at 9:37 pm
I have to stop lammp and then start again. Doesn’t work with “sudo ./lamp restart” option
December 30th, 2011 at 2:18 pm
The problem is due to the fact that XAMPP package is installed for “nobody” user including the mysql and web server. So I am giving a short tutorial on how to make it work:
1) After downloading your XAMPP package, do not use any GUI utility to extract it. please use the tar command with root permission (So that you can access you /opt directory)
sudo tar -xzvf xampp-package-name -C /opt/
Using the archival tools other than tar will result in problems.
2) When you execute the above command, the directory is inaccessible to you as a normal user. To access this directory you will need root privileges with sudo command. This is a problem while developing. As a workaround, we will make htdocs accessible by your current user using the following commands.
sudo chown -hR username /opt/lampp/htdocs
sudo chmod -R 755 /opt/lampp/htdocs
The above method wont show any warning as the lampp directory is not accessible to the world (except for htdocs). The above method works because mysql requires access to the /opt/lampp directory as “nobody”. When you perform chown for your user, nobody comes under others and 755 wont work and the only solution is 777 (which is bad).
December 30th, 2011 at 3:04 pm
For people who have changed the ownership from “nobody” to other users, change back the ownership to nobody for the entire package using:
sudo chown -hR nobody /opt/lampp
After executing the above command, make your htdocs accessible using the command listed in above post(point no. 2)
This may result in a phpMyAdmin error. To tackle this problem, change the ownership of /opt/lampp/phpmyadmin and permissions accordingly:
sudo chown -hR username /opt/lampp/phpmyadmin
sudo chmod 755 /opt/lampp/phpmyadmin
This will remove any phpmyadmin error.
January 3rd, 2012 at 12:58 pm
Thank you very much! It helped me a lot!!