Wednesday, October 5, 2011

Xampp: another mysql daemon is already running

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl.

I used XAMPP a lot without any issues. However, this weekend I got my hands into Ruby (on Rails). I installed a lot of stuff and went through a lot of configurations and then MySQL on XAMPP stopped working.

The issue was when I start XAMPP using the command
sudo /opt/lampp/lampp start

I got the following output:

Starting XAMPP for Linux 1.5.3a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Another MySQL daemon is already running.
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

The Mysql port was already in use by some other application because of which it was not available for xampp. XAMPP comes packaged with it's own MySQL server and I already had another one (after my Ruby on Rails work) taking up the port. This prevents you from using anything which uses Mysql like phpMyadmin or any CMS on your server.

A workaround this wold be typing the following command in your terminal.

sudo /etc/init.d/mysql stop

This stops the Mysql daemon because of which the port is now available for xampp. Start xampp again and you are good to go.

However, you need to start/stop the mysql instance using the port depending on which application you need to use. It would be brilliant if there was a way to have XAMPP-MySQL not conflict with MySQL instance that you use for any other application say Ruby.

7 comments:

  1. tried running that command, got a message saying: Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql stop

    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) utility, e.g. stop mysql
    any idea?

    ReplyDelete
    Replies
    1. That's true. You get the message. But, mysql daemon is stopped after you type the init command. So, it works. And you can run XAMPP.

      However, I tried the other commands mentioned but it always gives a call rejected message. I am not sure what it does.

      Delete
  2. i get sudo: /etc/init.d/mysql: command not found
    ?

    ReplyDelete
    Replies
    1. Sudo is a command that gives you right as a superuser. So that you can perform commands that an administrator of the computer can.

      Note the space between sudo and /etc
      and mysql and stop, that is
      sudo /etc/init.d/mysql stop

      Delete
    2. hahaha... i have this problem to... when your system have mysql installed try to check

      sudo systemctl status mysqld.service
      if mysqld.service is runing
      then stop it
      sudo systemctl stop mysqld.service

      if the problem is another apache daemon is running then try this :

      sudo systemctl status httpd.service
      if httpd is running the stop it
      sudo systemctl stop httpd.service

      and then restart the lampp

      and voila... lampp started normally

      hohoohoho

      Delete