XAMPP MySQL deactivated error
Installing XAMPP is a quick way to setup an Apache Server with PHP and a MySQL database.
But sometimes there's some kind of configuration error or bug that doesn't allow to start the MySQL service. Checking the status with the XAMPP control panel will display a message of "MySQL database DEACTIVATED".
How to fix the XAMPP MySQL deactivated bug
While I'm not sure about the causes of this error, there is a quick fix to activate MySQL in XAMPP following 2 simple steps.
- First, try not to configure your MySQL database as a service. This is asked during the XAMPP installation. So don't select the checkbox of installing MySQL databases as a system service.
- Second, create a basic configuration file for your new MySQL installation (you can do this automatically using Win MySQL admin).
Yes, there's an automated way to generate a basic config file for MySQL using tools installed by default in XAMPP. Just go to [XAMPP installation folder] / mysql / bin and run winmysqladmin.exe. Type a new username and password, and let the MySQL admin program generate the default mysql initialization file.
And that's it! A MySQL disabled as a Windows service, and a default configuration file with MySQL username and password defined should change your XAMPP SQL status from "MySQL database deactivated" to MySQL database ACTIVATED.
How to check that MySQL status is active
You can check the status of the MySQL databases opening the XAMPP control panel: MySQL should have a green running tag next to it.
Notice that I wouldn't keep using the Win MySQL Admin once you turned your MySQL service active: it's an old, discontinued application that seems to throw random Windows errors. But don't worry: just close the Win MySQL Admin window and keep using the built-in phpMyAdmin from the XAMPP default installation.
You can open the phpMyAdmin menu to check the active status of the MySQL databases from the XAMPP Apache main menu: start the Apache server, open the main server page using your web browser (just type "localhost" by default in your web browser address bar) and click the phpMyAdmin link to check that your MySQL databases are enabled.
I hope this helped you to activate your MySQL databases in XAMPP! Now, have a happy coding and local server testing!