I installed xampp and when I try to start the service, MySQL doesn't start only apache and proFTPD

and I was getting this error

mysqli_real_connect(): (HY000/2002): Connection refused

After some search I found that there is an already running MySQL service other than xampp's

so currently everytime I start my xampp I have to stop the MySQL service first using

sudo /etc/init.d/mysql stop


sudo /opt/lampp/lampp start

is there a way I can remove this service completely so xampp can be started without my having to stop the service first before starting xampp?


If MySQL database is not required in your setup you can disable it permanently with:

sudo systemctl disable mysql

But if you wish to remove it (keep in mind that your MySQL databases will be deleted), then first you should check what version of MySQL is installed:

dpkg -l | grep -E "^ii.*(mysql|mariadb)-server"

Then remove these packages with:

sudo apt remove mariadb-server*


sudo apt remove mysql-server*

depending on what version you have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.