44

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?

Melebius
  • 6,183
  • 4
  • 39
  • 52
BeHaa
  • 509
  • 1
  • 6
  • 12
  • Check the error logs in starting mysql.. Hva you uninstalled completely any previous mysql or check that there is no mysql installation before? – Aman Aggarwal Jan 22 '14 at 10:24
  • There is no error logs in neither the XAMPP Control Panel, nor in mysql_error.log . I havn't uninstalled anything after installing the XAMPP, which I did today. – BeHaa Jan 22 '14 at 11:49
  • possible duplicate of [MySQL won't start on XAMPP server](http://stackoverflow.com/questions/17347053/mysql-wont-start-on-xampp-server) – Andrew T. Oct 02 '14 at 01:35
  • possible duplicate of [xampp MySQL does not start](http://stackoverflow.com/questions/18177148/xampp-mysql-does-not-start) – Ysr Shk Nov 06 '14 at 14:54
  • Here is an article you can refer to. It outlines a few possible causes and a few ways to fix it, which is very useful: https://blog.terresquall.com/2022/08/xampp-mysql-not-starting-on-windows/ – John Doe Sep 01 '23 at 09:16

20 Answers20

45

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.

  • My MYSQL server on XAMPP was instantly getting stopped. I didn't know what was running on port 3306. This is the solution. Thanks! – Fanoflix Aug 21 '22 at 11:23
11

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.

Eoin
  • 1,413
  • 2
  • 17
  • 32
  • 1
    Thanks! Originally I had it under `C:\xampp-portable-win32-7.2.3-0-VC15\xampp` then pulled out the xampp directory and renamed it to `C:\xampp2` (because I also had an older version), and then finally it would only work when I renamed the old one something different and had this new one simply at `C:\xampp` like you did and I normally do too. – Modular Mar 22 '18 at 03:45
  • 1
    exactly the same thing :D – Bashir Abdelwahed May 28 '18 at 00:53
8

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

Alok kumar
  • 81
  • 1
  • 1
6
  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.
TrebledJ
  • 8,713
  • 7
  • 26
  • 48
surbaniak
  • 81
  • 1
  • 3
  • 1
    Had this exact issue and didnt had the checkbox, might want to now , run the xampp control panel with administrator rights. Without administrator right the checkbox is not found. – Jasper Lankhorst Sep 06 '19 at 19:33
  • 1
    Be careful I think you will loose all the data ( databases ) in your old installation. Thanks – MindRoasterMir May 28 '20 at 08:18
6

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

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Thomas
  • 2,622
  • 1
  • 9
  • 16
  • This solution worked for me since I used wamp server before so mySQL path was set to old directory. Thank you very mcuh. – Ayman Al-Absi Jan 13 '20 at 19:54
4

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.

nguyendc
  • 57
  • 2
3

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

Arghya
  • 31
  • 2
3

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
2

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.
tao
  • 82,996
  • 16
  • 114
  • 150
1

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.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Oltamor
  • 121
  • 1
  • 4
1

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

Shibhe Tepa
  • 102
  • 4
1

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, I've manually changed the directories inside my.ini (base dir, data dir , ...). After that mysql started successfully.

SAMPro
  • 1,068
  • 1
  • 15
  • 39
1

I solved this problem by removing all the information in the path

C:\xampp\mysql\data

And copy the information inside this path

C:\xampp\mysql\backup
Ali Azmoodeh
  • 152
  • 2
  • 10
0

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.

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43
radek
  • 47
  • 1
  • 7
0

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.

Bawm
  • 79
  • 1
  • 3
0

This worked for me.

  1. Search for Services in Windows Start

enter image description here

  1. Find MySQL in it.

enter image description here

  1. Right Click and Stop MySQL. Would work on XAMPP Now.

Note: If you wanna use the MYSQL prompt again, you will have to start the MYSQL from Service again.

Kavya Goyal
  • 126
  • 1
  • 2
0

In my case I had xampp installed with PHP 7.4. But I needed PHP 8. I downloaded xampp with PHP 8. Installed it to C:/xampp8/ folder. When I started the new version, it started successfully. But then I realized that I needed the database data from the old xampp installation. I stopped the new xampp(php 8 version) , and tried to start xampp (php 7.4 version) and saw that Apache started and was working fine, but mysql was not starting. I tried many settings but couldn't start mysql from the old xampp. Solution in my case to copy the data to the new xampp I went to C:/xampp_old/mysql/data folder. And saw that each of my database has a separate folder inside data folder. I copied all the folders and pasted into C:/xampp8/mysql/data/ Then I started new xampp and looked in phpmyadmin via browser and I got all my databases back.

Noor Ahmed
  • 178
  • 12
0

In the xampp control panel, to the left of "MySQL" there is a green checkbox, click it to uninstall MySQL service. After that you can start MySQL from the same control panel. You can install those services again, it will still work.

Sunil Kumar
  • 6,112
  • 6
  • 36
  • 40
-1

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

Dao Minh Duc
  • 349
  • 2
  • 5
-1

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

Ahmad
  • 1,618
  • 5
  • 24
  • 46