[mysql] Xampp MySQL not starting - "Attempting to start MySQL service..."

I've just installed XAMPP for Windows - should be the newest version (XAMPP Control Panel v3.2.1).

Apache is running just fine on port 80 and 443, but MySQL is not starting. When I press the start button, I get this message:

Attempting to start MySQL service...

Then a window pops up and asks me if I want to allow this, which I want. But nothing happens after that. I can press as many times as I want, but with the same result.

What can I do with MySQL?

This question is related to mysql windows apache installation xampp

The answer is


After Stop xampp, go to configure and change the port 3306 to 3308 of mysql and save. Now start the sql......Enjoy


Had this problem today, on a Windows 10 machine. Opened C:\xampp\data\mysql_error.log and looked for lines containing [ERROR].

Last error line was:

... [ERROR] InnoDB: File (unknown): 'close' returned OS error 206. Cannot continue operation

Important note: if your error is different, google it (you'll likely find a fix).

Searching for the above error, found this thread on Apache Friends Support Forum, which led me to the fix:

  1. Open C:\xampp\mysql\bin\my.ini and add the following line towards the end of [mysqld] section (above the line containing ## UTF 8 Settings):
innodb_flush_method=normal
  1. Restart MySQL service. Should run just fine.

if all solutions up did not work for you, make sure the service is running and not set to Disabled!
Go to Services from Control panel and open Services,
Search for Apache2.4 and mysql then switch it to enabled, in the column of status it should be switched to Running


I have the same problem. Finally found the solution:

The Relocate XAMPP option in the setup tool didn't correctly relocate the paths and corrupted them, but I've manually change the directories inside my.ini (base dir, data dir , ...). After that mysql started successfully.


  1. In the cmd type: services.msc Find MySql and change properties to the disabled.
  2. In the control panel of Xampp uninstall MySql by the checkbox on the left side, and install again by the click in the same checkbox.

Only stop My sql In Xampp For 15 Min After 15 min restart Mysql .If my sql running But Port Not Showing in Xampp then Click Config > my.ini edit this file and change port no 3306 > 3307 and save and Restart xampp .........


Everytime my MySQL starts, it will stop, then I noticed that some files are getting generated in C:\xampp\mysql\data. I tried deleting some files (like the Error logs, err file, etc.) on that directory. Back up first what you're going to delete to avoid losing data.

I don't know how it works. I'm just trying to enable HTTPS in my local machine but then suddenly MySQL can't be started. But now it's working.

I'm using Windows 10 and XAMPP 3.2.4.


I can share how I solved the problem in my case.

It seems that somehow I had mySQL Server 5.7 installed. It didn't show on Add/Remove Programs list in Windows tough so I wasn't aware of it. I marked that after I looked up the XAMPP log.

Just after XAMPP launched it has shown in the log that there is a conflict in mySQL and indicated the folder where my mySQL Server 5.7 is installed. I removed mySQL 5.7 manually from Program Files (x86) and ProgramData folder, restarted and XAMPP mySQL started normally then.

I've tried only stopping the mySQL service but for me it didn't work. Only manually deleting all mySQL 5.7 folders seemed to have helped.


One of many reasons is xampp cannot start MySQL service by itself. Everything you need to do is run mySQL service manually.

First, make sure that 'mysqld.exe' is not running, if have, end it. (go to Task Manager > Progresses Tab > right click 'mysqld.exe' > end task)

Open your services.msc by Run (press 'Window + R') > services.msc or 0n your XAMPP ControlPanel, click 'Services' button. Find 'MySQL' service, right click and run it.


If you have other testing applications like SQL web batch etc, uninstall them because they are running in port 3306.


Windows 10 Users:

I had this issue too. A little bit of investigating helped out though. I had a problem before this one, that 3306 was being used. So what I found out was that port 3306 was being used by another program. Specifically a JDBC program I was trying to learn and I had xammp installed before I tried this JDBC out. So I deleted the whole file and then here I am, where you're at. The issue was that my 'ImagePath'(registry variable) was changed upon installing mySql again. To put it simply, xammp doesn't know where your mysqld.exe is at anymore, or the file is not in the location that you told it to be. Here's how to fix it:

  1. Open run (Win + r) and type 'regedit'. This is where you edit your registry.
  2. Navigate to: HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > MySql

enter image description here

  1. Click on mySql and notice the ImagePath variable. Right click 'ImagePath' and click modify.
  2. Enter the location of your xammp mySqld file (navigate through xammp to find it) Although it is likely the same as mine.

Cool Sources:

https://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850

https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html

Thanks dave


Did you use the default installation path?

In my case, when i ran mysql_start.bat I got the following error:

Can`t find messagefile 'D:\xampp\mysql\share\errmsg.sys'

I moved my xampp folder to the root of the drive and it started working.

Hope it helps


Only for windows I have fixed the mysql startup issue by following below steps

Steps:

  1. Open CMD and copy paste the command netstat -ano | findstr 3306 If you get any result for command then the Port 3306 is active

  2. Now we want to kill the active port(3306), so now open powershell and paste the command Stop-Process -Id (Get-NetTCPConnection -LocalPort 3306).OwningProcess -Force

Where 3306 is active port. Now port will be inactive

Start Mysql service from Xampp which will work fine now

Note: This works only if the port 3306 is in active state. If you didn't get any result from step 1 this method is not applicable. There could be some other errors

For other ports change 3306 to "Required port"

Ways to open CMD and Powershell

  1. For CMD-> search for cmd from start menu
  2. For Powershell-> search for powershell from start menu

In Windows, you should go: Start > Run > services.msc > Apache 2.4 > Properties > Start Mode > Automatic > Apply > Start > OK > [Same as MySQL]


If you have MySQL already installed on your windows then go to services.msc file on your windows and right click the MySQL file and stop the service, now open your XAMPP and start MySQL. Now MySQL will start on the port 3306.


I had an issue with this because I had accidentally installed XAMPP to c:\windows\program files (x86) which caused a Windows permissions issue.

The installation says not to install it there, but I thought it had said to install it there.

I uninstalled and reinstalled to c:\xampp and it worked.


Examples related to mysql

Implement specialization in ER diagram How to post query parameters with Axios? PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' phpMyAdmin - Error > Incorrect format parameter? Authentication plugin 'caching_sha2_password' is not supported How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Connection Java-MySql : Public Key Retrieval is not allowed How to grant all privileges to root user in MySQL 8.0 MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to apache

Enable PHP Apache2 Switch php versions on commandline ubuntu 16.04 Laravel: PDOException: could not find driver How to deploy a React App on Apache web server Apache POI error loading XSSFWorkbook class How to enable directory listing in apache web server Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details How to enable php7 module in apache? java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing while starting Apache server on my computer

Examples related to installation

You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) Conda version pip install -r requirements.txt --target ./lib How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" PackagesNotFoundError: The following packages are not available from current channels: Tensorflow import error: No module named 'tensorflow' Downgrade npm to an older version Create Setup/MSI installer in Visual Studio 2017 how to install tensorflow on anaconda python 3.6 Application Installation Failed in Android Studio How to install pip for Python 3.6 on Ubuntu 16.10?

Examples related to xampp

Xampp localhost/dashboard phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) Is there way to use two PHP versions in XAMPP? Where to find htdocs in XAMPP Mac phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1? How to turn on/off MySQL strict mode in localhost (xampp)? mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it How to install mcrypt extension in xampp Fatal error: Uncaught Error: Call to undefined function mysql_connect()