mysql is not starting in XAMPP UBUNTU
Asked Answered
H

20

19

I have one instance PHP and MySQL installed, now i am trying to install XAMPP on my system. I am able run the PHP of XAMPP. but while starting the service, i am getting the below error. I want both the MySQl to be running by stopping the services of other.

Here is my terminal ouput:

$ sudo /opt/lampp/lampp start
Starting XAMPP for Linux 1.8.0...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Couldn't start MySQL!
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

Please help, thanks

Hubblebubble answered 30/5, 2013 at 8:1 Comment(2)
check the logs /opt/lampp/logsBiskra
possible duplicate of Couldn't start MySQL! while starting XAMPP.Speroni
R
36

All you have to do is stop Mysql and apache2 first

sudo service mysql stop
sudo /etc/init.d/apache2 stop

Then Start your

sudo /opt/lampp/lampp start
  1. Switch to the XAMPP installation directory. Type in

    cd /opt/lampp
    

    and press ↵ Enter

  2. Enter the "Open" command. Type in

    sudo ./manager-linux-x64.run
    

    and press ↵ Enter

Enter your password when prompted. Type in the password you usually use to log into your computer, then press ↵ Enter.

Ravenna answered 1/10, 2018 at 4:10 Comment(0)
P
20

If you're running ubuntu why on earth are you using XAMPP?

sudo apt-get install apache2 mysql-server phpmyadmin php5;

cd;mkdir www

pico /etc/apache2/sites-available/default

change document root to the www directory you just made which should be something like /home/yourusername/www/

service apache2 restart

Congratulations you're now running a full blown LAMP stack properly on a linux machine. http://localhost/ and http://localhost/phpmyadmin/

Programme answered 30/5, 2013 at 8:9 Comment(1)
I have a query if you could help. I am running phpmyadmin and have created a folder in named as /www/test , I have added the conf file in sites-available in apache2 folder, I created a php script which was accessing the data-base but no changes occur whenever I try to add something to the db, I think mysql is not linked somehow. Could you help?Fides
S
15

This helped me...

Following content is from MySQL Database cannot start on XAMPP for Mac

1. Open XAMPP Installation Directory

2. Open "etc" Folder

3. Find "my.cnf" file and open it in any text editor

4. Change Port from 3306 to 3307 (if you have installed skype or other apps)

5. Add "innodb_force_recovery=1" under "myisam_sort_buffer_size=8M"

6. Save "my.cnf" file

7. Open xampp:-

8. Goto Computer(opt)> Open lampp folder(Search "lampp" if u can't see lampp folder)> Open manager-linux.run

9. In XAMPP Click on "Manage Server" Tab> Click on "Mysql Database"> Click on "Configure"> Change Port from 3306 to 3307> save and start the mysql database. 

You Get A message "Starting MySQL SUCCESS! "

Scratchy answered 18/2, 2017 at 7:50 Comment(1)
this is really good approachOstium
J
10

All you have to do is stop Mysql and apache2 then restart them.

  1. Stop MySql and Apache2

    sudo service mysql stop

    sudo /etc/init.d/apache2 stop

  2. Restart

    sudo /opt/lampp/lampp start

This should work

Cheers

Jocelyn answered 24/6, 2018 at 6:10 Comment(2)
Please add some explanation to your answer - why should restarting Apache help with MySQL problems?Wera
Your solution is the only one that has worked for me after hours of Googling and uninstallations upon reinstallations. ThanksLongshore
H
6

Thanks for the answers. I was tryin to start the mysql service when already one is already running. Stop the instance of the mysql and apache before starting the XAMPP mysql and apache

sudo service apache2 stop

sudo service mysql stop

then

sudo /opt/lampp/lampp start

Hubblebubble answered 22/4, 2015 at 15:43 Comment(0)
L
6

If mysql is not starting in xampp, it might be a port conflict issue. Mysql run by default on port 3306. you need to check if another application is occupying that port. use following command to check app occupying a port

Linux: netstat -tulpn | grep 3306
Window: netstat -a -b

if you find an application occupying that port, stop the application and restart xampp. As an alternative, you can go to php.ini file or click configure in the dropdown and change the mysql port to 3307

Lotta answered 9/3, 2019 at 12:25 Comment(0)
B
2

I have a same problem.

my way is

  1. backup your htdocs folder
  2. backup your database folder '/opt/lampp/var/mysql'
  3. check user on /opt/lampp/var/mysql $ ls -la
  4. reinstall xampp full with delete data
  5. copy paste your database folder to /opt/lampp/var/mysql
  6. change user access after paste on /opt/lampp/var/mysql all file and folder

to check user on folder

$ cd /opt/lampp/var/mysql
$ ls -la

to change user on folder for all files and folder

$ sudo chown -R mysql:mysql *

and 1 file based on your computer ex:

$ sudo chown -R mysql:root emild-desktop.err

emild-desktop.err is log error of my pc

  1. Copy Paste your htdocs folder on /opt/lampp

  2. Restart lampp service.

    $ sudo /opt/lampp/lampp start

Begum answered 22/7, 2016 at 9:16 Comment(0)
L
2

If apache and mysql datbase both stoped then run following commands

  1. sudo apachectl stop

Stop MySql and Apache2

  1. sudo service mysql stop

  2. sudo /etc/init.d/apache2 stop

Restart

  1. sudo /opt/lampp/lampp start

That works for me

Luehrmann answered 21/6, 2021 at 12:21 Comment(1)
Mine wasn't starting, then it displayed "Permission denied". Ran sudo chown -R mysql:mysql /opt/lampp/var/mysql in addition to your commands and it worked like a charm!Catalinacatalo
P
1

I've resolved in this way:

sudo chmod -R 777 /opt/lampp

sudo chown -hR nobody /opt/lampp
sudo chmod -R 755 /opt/lampp

i stop the other service running

 sudo /etc/init.d/mysql start   
Penetration answered 5/3, 2019 at 15:9 Comment(0)
D
1

You can try this, it worked for me.

sudo /opt/lampp/lampp security

Ref: https://forums.linuxmint.com/viewtopic.php?t=246011

Delirious answered 28/11, 2020 at 9:19 Comment(0)
C
0

This is the easiest fix that worked for me after trying a billion suggestions from various forums. First you need to update your kernel to the latest stable version, 3.19 (You really need to do this for it to work without any issues even in future (after updates)).

  1. Go to http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.19-vivid/

  2. Look for the generic ones (ignore lowlatency)

    • Download according to whether your comp is 64bit(amd64) or 32bit(i386); there will be 2 files that you will be downloading. Remember to ignore the lowlatency ones.
    • Next, get this file also: linux-headers-3.19.0-031900_3.19.0-031900.201502091451_all.deb .. from the same place therefore making the total number of files that you will need to have to be 3.
    • Install all the three files simply by double-clicking on their icons in your download directory

Install xampp directly from the apachefriends site: https://www.apachefriends.org/index.html

Lastly, click on start all in the 'Manage Servers' tab and watch them all start, mysql database, Proftpd and Apache web server. This also fixes the phpmyadmin (browser) error 2002.

Choreodrama answered 4/4, 2015 at 0:13 Comment(1)
Please explain further why a new kernel should be needed, any why this should be installed in any other way than through aptWera
F
0

You may run,

sudo stop mysql

in terminal to stop mysql service and restart XAMPP.

Ferdy answered 21/10, 2015 at 4:19 Comment(1)
Please add some further explanation to your answer. What makes you think that stopping a MySQL server helpsWera
D
0

First of all you need to install gksu with the following command:

sudo apt-get install gksu

Then, run:

gksu gedit /usr/share/applications/xampp-control-panel.desktop and save the following code in the file.

(You are using 64 bit system so there is no need to change anything, simply do copy paste)


[Desktop Entry]

****Encoding=UTF-8
Name=XAMPP Control Panel
Comment=Start and Stop XAMPP
Exec=gksudo /opt/lampp/manager-linux-x64.run
Icon=/opt/lampp/htdocs/favicon.ico
Categories=Application
Type=Application
Terminal=false****

Note: For 32 bit xampp type "manager-linux.run" at place of "manager-linux-x64.run"

Run following command in terminal:

sudo apt-get update Now check applications, its icon has been created.You can get it from search

Distressed answered 10/4, 2018 at 6:34 Comment(1)
Please add some explanation to your answer such that others can learn from it - why should any other program like gksu (which isn't even supported any more since Ubuntu 18.04) be needed?Wera
D
0

I was able to resolve my issue when I found out that the service "mysqld" was running in parallel on port 3306.

I was able to find this information out by running "netstat -tulpn | grep 3306" in the terminal, which showed that "mysqld" was running. Which was suggested by @Adobe, thanks.

I then ran "sudo service mysqld stop" and restarted the MySQL server on the XAMPP and it worked.

Disparage answered 23/2, 2021 at 7:7 Comment(0)
D
0

If in your system already running the php and mysql then first you have to stop Mysql and apache2 then restart them using installed xampp.

First stop MySql and Apache2 from running system :

#1 sudo service mysql stop

#2 sudo /etc/init.d/apache2 stop

Now restart the Xampp :

#1 sudo /opt/lampp/lampp start

Hope! This will work for you.

Deplorable answered 17/6, 2021 at 7:28 Comment(0)
M
0

You may install mysql default version. first, remove the MySQL server using the following command:

sudo apt-get remove mysql-server
sudo apt-get autoremove
Messidor answered 12/7, 2021 at 22:43 Comment(0)
G
0

change your mysql port from 3306 to 3307 maybe 3306 is being used somewhere else

Gallenz answered 10/9, 2022 at 5:17 Comment(0)
M
0

select Mysql server in the xampp app and select configure, in configure, change the port to 3307 to 3306.

Metapsychology answered 20/12, 2022 at 4:24 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Jesseniajessey
P
0

If it's not port conflict of 3306 with another service using the same port.

sudo /opt/lampp/lampp stop

open /opt/lampp/etc/my.cnf

sudo nano /opt/lampp/etc/my.cnf

change user to your username/user-account then restart the server

sudo /opt/lampp/lampp start

hope this helps

Principate answered 15/1, 2023 at 12:6 Comment(0)
Y
-1

My problem was solved with this simple method:

  1. paste this command in the terminal sudo/opt/lampp/manager-linux-x64.run
  2. stop all the services
  3. go to the MySQL database cofing button
  4. change the port from 3306 to 3307
  5. Now run all
  6. now everything will work fine
Yakutsk answered 18/2, 2023 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.