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

2

21 Answers 21

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.

Sign up to request clarification or add additional context in comments.

Comments

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/

1 Comment

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?
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! "

1 Comment

this is really good approach
11

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

2 Comments

Please add some explanation to your answer - why should restarting Apache help with MySQL problems?
Your solution is the only one that has worked for me after hours of Googling and uninstallations upon reinstallations. Thanks
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

Comments

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

Comments

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

Comments

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

1 Comment

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!
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 

Comments

1

You can try this, it worked for me.

sudo /opt/lampp/lampp security

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

Comments

0

You may run,

sudo stop mysql

in terminal to stop mysql service and restart XAMPP.

1 Comment

Please add some further explanation to your answer. What makes you think that stopping a MySQL server helps
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.

1 Comment

Please explain further why a new kernel should be needed, any why this should be installed in any other way than through apt
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

1 Comment

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?
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.

Comments

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.

Comments

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 

Comments

0

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

Comments

0

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

1 Comment

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.
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

Comments

0

I was receiving XAMPP: Starting MySQL...OK as i was starting the apache and mysql services using the sudo /opt/lampp/lampp start command. But the mysql service eventually was failing to start.

What i found was that the /opt/lampp/var/mysql directory shoud be owned by the user mysql . In my case it was owned by the user i was logged in as. I changed the ownership of this directory like so:

sudo chown -R mysql:mysql /opt/lampp/var/mysql

And restarted the lampp service.

all was well.

Comments

-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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.