[mysql] XAMPP - Error: MySQL shutdown unexpectedly

I have reinstalled XAMPP for some reason and MySQL is not working, giving the following error in the console:

01:56:03  [mysql]   Error: MySQL shutdown unexpectedly.
01:56:03  [mysql]   This may be due to a blocked port, missing dependencies, 
01:56:03  [mysql]   improper privileges, a crash, or a shutdown by another method.
01:56:03  [mysql]   Check the "/xampp/mysql/data/mysql_error.log" file
01:56:03  [mysql]   and the Windows Event Viewer for more clues

When checking the "/xampp/mysql/data/mysql_error.log" file I get:

130302  1:48:06  InnoDB: Waiting for the background threads to start
130302  1:48:07 InnoDB: 1.1.8 started; log sequence number 1600324627
130302  1:48:07 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302  1:48:07 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
130302  1:48:07 [Note] Server socket created on IP: '0.0.0.0'.
130302  1:51:12 [Note] Plugin 'FEDERATED' is disabled.
130302  1:51:12 InnoDB: The InnoDB memory heap is disabled
130302  1:51:12 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130302  1:51:12 InnoDB: Compressed tables use zlib 1.2.3
130302  1:51:12 InnoDB: Initializing buffer pool, size = 16.0M
130302  1:51:12 InnoDB: Completed initialization of buffer pool
130302  1:51:12 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130302  1:51:12  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130302  1:51:13  InnoDB: Waiting for the background threads to start
130302  1:51:14 InnoDB: 1.1.8 started; log sequence number 1600324627
130302  1:51:14 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302  1:51:14 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
130302  1:51:14 [Note] Server socket created on IP: '0.0.0.0'.
130302  1:56:01 [Note] Plugin 'FEDERATED' is disabled.
130302  1:56:01 InnoDB: The InnoDB memory heap is disabled
130302  1:56:01 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130302  1:56:01 InnoDB: Compressed tables use zlib 1.2.3
130302  1:56:01 InnoDB: Initializing buffer pool, size = 16.0M
130302  1:56:01 InnoDB: Completed initialization of buffer pool
130302  1:56:01 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130302  1:56:01  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
130302  1:56:02  InnoDB: Waiting for the background threads to start
130302  1:56:03 InnoDB: 1.1.8 started; log sequence number 1600324627
130302  1:56:03 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130302  1:56:03 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
130302  1:56:03 [Note] Server socket created on IP: '0.0.0.0'.

That is just a part of the log, the full one is a bit too big.

Help?

This question is related to mysql xampp

The answer is


If Apache is running without any issue , and u find some blockage by system security settings , simply allow it instead of blocking or closing the dialog box. And change the port number for MySQL to 3607 as it was before 3606 . It worked for me .


There may be MySQL server installed previously in your computer try to uninstall that and start MySQL at the XAMPP This solved mine


To resolve this,

Go to your XAMPP folder,

XAMPP -> mysql -> bin -> "my.ini"

After opening my.ini configuration file, Replace 3306 with 3308 in couple of places, because 3308 is a free port.

XAMPP -> php -> "php.ini"

Do the same as you did in "my.ini" file which is changing port 3306 to 3308.

Then, restart the XAMPP server.

It works fine.


just run your xammp as an administrator, it works


Well first thing ,, I know its late so I dont know if anyone will upvote it but oh well its okay,, secondly, uninstalling xampp might not do you any good because the process using the port 3306 (Mysql's default port) will still be running somewhere on your system. might be skype, but might not be skype.

so the best way would be to find out which process is using port 3306, and then terminate the process.

so to find out which process is using port 3306, open command prompt, and type

netstat -n -o -a

you will get a screen like this.

Then look for the address with port number 3306 and find out the PID corresponding to that.

Then simply open a command prompt as administrator and type

taskkill /F /PID 1234

replace 1234 with your respective PID. Then you can try starting mysql and it will work.


And now if you are lazy to do this step all over again when restarting the computer,,,

you can simply use the following batch script to terminate the process automatically and enjoy :)

@echo off
setlocal enableextensions
set "port=3306"
for /f "tokens=1,4,5" %%a in (
    'netstat -aon ^| findstr /r /c:"[TU][CD]P[^[]*\[::\]:%port%"'
) do if "%%a"=="UDP" (taskkill /F /PID %%b) else (taskkill /f /PID %%c)
endlocal
pause

save it as anything.bat and run it everytime you want to use mysql. :)



** -> "xampp->mysql->data" cut all files from data folder and paste to another folder

-> now restart mysql

-> paste all folders from your folder to myslq->data folder

and also paste ib_logfile0.ib_logfile1 , ibdata1 into data folder from your folder.

your database and your data is now available in phpmyadmin..**


The best solution for this problem is just open your mysql configuration directive file my.ini present inside the folder C:\xampp\mysql\bin and change the information related to the ports, usually some programs occupy the port no. 3306 as a result of that it stops working, Now you follow two steps to make it working.

enter code here

    Step-1. Search for ['client'],  you can see some thing like this

            [client] 
            # password       = your_password 
            port            = 3306
            socket          = "C:/xampp/mysql/mysql.sock"
 Now in the port section remove 3306 and add port = 3306 > 3307 as shown   below.

            [client] 
            # password       = your_password 
            port            = 3306 > 3307
            socket          = "C:/xampp/mysql/mysql.sock"


    Step -2. Similarly Search for  ['mysqld'], you can see something like this 

            [mysqld]
            port= 3306
            socket = "C:/xampp/mysql/mysql.sock"
            basedir = "C:/xampp/mysql" 
            tmpdir = "C:/xampp/tmp" 
            datadir = "C:/xampp/mysql/data"
            pid_file = "mysql.pid"
            # enable-named-pipe
            key_buffer = 16M
            max_allowed_packet = 1M
            sort_buffer_size = 512K
            net_buffer_length = 8K
            read_buffer_size = 256K
            read_rnd_buffer_size = 512K
            myisam_sort_buffer_size = 8M
            log_error = "mysql_error.log"


            Now here change the port number 3306 to 3307 and add a line "innodb_force_recovery = 1" exactly as shown below.


            [mysqld]
            port= 3307
            socket = "C:/xampp/mysql/mysql.sock"
            basedir = "C:/xampp/mysql" 
            tmpdir = "C:/xampp/tmp" 
            datadir = "C:/xampp/mysql/data"
            pid_file = "mysql.pid"
            # enable-named-pipe
            key_buffer = 16M
            max_allowed_packet = 1M
            sort_buffer_size = 512K
            net_buffer_length = 8K
            read_buffer_size = 256K
            read_rnd_buffer_size = 512K
            myisam_sort_buffer_size = 8M
            log_error = "mysql_error.log"
            innodb_force_recovery = 1

Thats it, restart you mysql service, it will work for sure.


This worked for me,

  1. quit the XAMPP
  2. cut the All files in C:\xampp\mysql\backup
  3. paste and replace files in C:\xampp\mysql\data
  4. run as administrator the XAMPP

if you inistalled mysql Independently you can stop mysql service if running no one of these answers are worked for me this work for me


I did all methods but didn't find the perfect solution!

  • Install Laragon instead of Xampp , You will pray for me.

In my case, I did two things:

  1. moved xampp/mysql/backup files into xampp/mysql/data
  2. RUN XAMPP as Administrator

It worked for me :)


In my case : I have just replaced

....xampp/mysql/backup files 

into

**xampp/mysql/data**

It worked for me.


For anyone that searched and pressed on this link, i solved it by simply searching for mysql notifier and stop mysql from running there, Then run mysql in xampp again and it runs. why this works ? iam not expert, but i think it is easy : port was taken already by mysql notifier so had to stop it there and run it here.


I am new to XAMPP, but I find that a combination of these suggestions works best (At least on Windows 8.1 with the latest version of XAMPP. Note that the computer I tested this on, also had skype).

First logon to skype and navigate to "Tools < Options < Advanced < Connection." Then check the box that says "Use port 80 and 443 for additional incoming connections." Save, close, and quit skype.

Next, on your XAMPP control panel, click "config < my.ini" and change lines 19 and 27 (should have port = 3306) from "3306" to "3307."

Also, you will need to navigate to xampp < phpMyAdmin < config.inc and change line 27, which should like something like this:

$cfg['Servers'][$i]['host'] = '127.0.0.1';

You will need to add "3307" as follows:

$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

Now, open your browser and you should see the xampp page when you type in "localhost." Additionally, if this is your first time using xampp, you may see a warning about your lack of password (highlighted in pink) on your localhost/phpmyadmin/ page. This is easily remedied by going to the "user accounts" tab in phpmyadmin, clicking on "edit privileges" and entering password. Remember to save the hashed version of any and all passwords you create as we will use this next! -I opened a notepad and saved (and numbered) them. Note that phpMyadmin will notify you of when you are changing the password for your current session (this will be displayed at the top of your phpMyadmin page and is very important, as you will need THAT specific hashed version of your password).

Next, you will need to navigate to the following location "xampp < phpMyAdmin < config.inc" on your computer and open and edit the file with a text editor. You will want to put in the hashed version of your password between the single quotes for password and change "AllowNoPassword" from true to false.

And, that ought to do it.


First you need to keep copy of following somewhere in your hard disk.

C:\xampp\mysql\backup

C:\xampp\mysql\data

After that

Copy every thing inside "C:\xampp\mysql\backup" and paste and replace it in
"C:\xampp\mysql\data"

Now your mysql will work in phpmyadmin but your tables will show "Table not found in engine"

For this you will have to go to the copy of "backup and data folders" which have created in your hard disk and there in the data folder copy "ibdata1" file and past and replace in the "C:\xampp\mysql\data".

Now your tables data will be available.


one reason I found ( and not mentioned in addition to other answers given in this site on the similar problem ) was by going to task manager in windows and stopping the mysqld which was running already and prevented mysql server from starting.


You must:

  • Close the xampp
  • Go to the folder where you installed it, if in (c:) may be something like C:\xampp\ , access folder C:\xampp\mysql\data
  • Delete the file ibdata1
  • Starts XAMPP again.

the true way is RECONFIGURE your app.with setup of MYSQL .you can open your setup again and change port from 3306 to 3307.

enter image description here


I would simply try reinstalling XAMPP.


  1. Rename the folder mysql/data to mysql/data_old (you can use any name)
  2. Create a new folder mysql/data Copy the content that resides in mysql/backup to the new mysql/data folder
  3. Copy all your database folders that are in mysql/data_old to mysql/data (skipping the mysql, performance_schema, and phpmyadmin folders from data_old)
  4. Finally copy the ibdata1 file from mysql/data_old and replace it inside the mysql/data folder
  5. Start MySQL from the XAMPP control panel