Compdigitec Labs

« | Home | »

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 is confusing because it does not say anything about the error. It is usually caused by permission errors because it is not able to write to a directory. Here is how to fix it:

  1. Open a terminal.
  2. Once the terminal has loaded, type “sudo chown -hR root /opt/lampp“. (Note: replace /opt/lampp with the XAMPP install directory).
  3. (Update from comment #7, untested) Type “sudo chmod -R 777 /opt/lampp“.
  4. Restart XAMPP with “sudo /opt/lampp/lampp restart“.
  5. Exit the terminal (right-hand corner X or type exit).

Alternate solution for those who could not get the above working:

  1. 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)
  2. 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/)
  3. (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/)
  4. Delete the entire LAMPP tree (sudo rm -rf /opt/lampp)
  5. Re-extract the LAMPP tree from root (tar xvfz /tmp/xampp-linux-1.7.1.tar.gz -C /opt)
  6. Restore htdocs folder to /opt/lampp (sudo cp -r /tmp/htdocs/* /opt/lampp/htdocs/)
  7. (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: Internet, Linux | 66 Comments »

66 Responses to “Solving “XAMPP: Couldn’t start MySQL!””

  1. Danish Satkut Says:
    December 30th, 2011 at 15:04

    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.

  2. Nico Says:
    January 3rd, 2012 at 12:58

    Thank you very much! It helped me a lot!!

  3. abudj Says:
    May 1st, 2012 at 06:56

    Siyam Junianto Says:
    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.
    ————————————-

    wow,that works for me too….thanx Junianto….

  4. Ominous Says:
    May 12th, 2012 at 18:05

    Thanks a lot. Worked at once.

  5. Puplu Says:
    May 13th, 2012 at 13:14

    didn’t work 🙁

  6. Franz Says:
    June 30th, 2012 at 19:33

    Thanks a lot, guy!!!
    This solved my problem!

  7. gema Says:
    August 19th, 2012 at 08:18

    thanks!!! it works !! 🙂

  8. mr nobody Says:
    August 23rd, 2012 at 04:55

    sudo chown nobody.root -R /opt/lampp/var/mysql/

    works and is better than setting all permissions to 777(read write execute for everyone)

    found here:
    http://www.apachefriends.org/f/viewtopic.php?f=17&t=49128

  9. Igor Says:
    October 17th, 2012 at 11:04

    Command ‘sudo tar -zxvf xampp-linux-1.8.1.tar.gz -C /opt’ solved this problem.

  10. Paulo Gomes Says:
    November 13th, 2012 at 09:08

    My resolution, that worked for me:
    http://adventux.blogspot.pt/2012/11/xampp-couldnt-start-mysql.html

    Cumprimentos,
    Paulo

  11. halms Says:
    April 26th, 2013 at 23:16

    #58 is a more secure solution. thanks.

  12. ตรวจสอบบัญชี ภูเก็ต Says:
    November 10th, 2024 at 21:43

    … [Trackback]

    […] Read More here to that Topic: compdigitec.com/labs/2009/05/30/solving-xampp-couldnt-start-mysql/ […]

  13. ข้อดีของการเลือกเล่น บอลสูงต่ำ กับ lsm99 Says:
    November 12th, 2024 at 06:26

    … [Trackback]

    […] Find More Information here on that Topic: compdigitec.com/labs/2009/05/30/solving-xampp-couldnt-start-mysql/ […]

  14. ทัวร์ธุรกิจจีน Says:
    November 27th, 2024 at 01:58

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2009/05/30/solving-xampp-couldnt-start-mysql/ […]

  15. ไก่ตัน Says:
    December 7th, 2024 at 01:55

    … [Trackback]

    […] Find More here to that Topic: compdigitec.com/labs/2009/05/30/solving-xampp-couldnt-start-mysql/ […]

  16. tga168 Says:
    December 11th, 2024 at 20:24

    … [Trackback]

    […] Information on that Topic: compdigitec.com/labs/2009/05/30/solving-xampp-couldnt-start-mysql/ […]

Comments