37

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?

1

28 Answers 28

91

Make sure you backup the mentioned folders before taking any action!

This worked for me,

  1. Quit the XAMPP
  2. Cut all files in C:\xampp\mysql\backup
  3. Paste and replace files into C:\xampp\mysql\data
  4. Run the XAMPP as administrator
Sign up to request clarification or add additional context in comments.

9 Comments

thanks. This should also be a correct answer for those who have no port reguarding issues. Does anyone know why this happens - why XAMPP puts mysql data files in backup? Is it due to some kind of update?
Probably the best option, some say to change ports and it becomes messy, but this is simple and easy... I just copied and pasted files, kept the backup files same .
Make sure to have a backup of the data folder like data_old and create new folder data then paste from backup.
After doing that I am getting table doesn't exist in engine error.
You broke all my installations, now all websites require a new WordPress installation
|
45

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 :)


EDIT:

IMPORTANT: Make a backup copy of your xampp/mysql/data folder before trying this method, if your backup folder is out of sync with your data folder (which is often the case), you will overwrite that data with the backup folder and your tables will be lost.

8 Comments

Do not do this guys, you will lost all of your tables, I did this, and now facing "Table dosen't exists in engine"
As said by @AlauddinAhmed. Now how to recover table data?
why this ans have much approve? please don't try this you will lose all table and all db.
You will lose all the data though MySQL will start working again. A useless method. Don't do. If you are very keen due to upvote, first take a backup of your backup folder.
Do not try this method. You will lose your database tables. If you want to try then just make a data folder backup first and then try it.
|
25

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.

4 Comments

This fixed the issue. Thanks a lot.
The best answer. It makes sense and it's straight forward
This worked but user accounts not added when checked in phpmyadmin
Finally, I got the best and safest answer 100% tested by me and it works , Thank you so much.
16

Caution! Don't delete ibdata1 file!

Just follow these steps and its done.

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

And its all done, Enjoy...

1 Comment

I use this answer about every other month. Still works great on windows.
7

If your skype is open, Quit skype and try,

or

Go to your xampp/wamp installed, search for httpd.conf. Open that file using textpad/notepad, search for Listen or 80 , update listen port to 8081 and save the file. Restart xampp/wamp, start the servers.


or
follow below steps in skype enter image description here

2 Comments

i can't find advanced option on newest skype versions!
Any other solution?
4
  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

Comments

2

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 .

Comments

2

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.

Comments

1

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

Comments

1

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.

Comments

1

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

Comments

1

In my case I had to go to C:\xampp\mysql\data and delete all files (not folders) but keep ibdata1 and my.ini. Restartet XAMPP, everything running again.

Hope that helps someone - had to look for hours before finding that!

Comments

1
  1. Rename the folder C:\xampp\mysql\data to C:\xampp\mysql\data_old (you can use any name)
  2. Create a new folder C:\xampp\mysql\data
  3. Copy the content that resides in C:\xampp\mysql\backup to the new C:\xampp\mysql\data folder
  4. Copy all your database folders that are in C:\xampp\mysql\data_old to C:\xampp\mysql\data (skip the mysql, performance_schema, and phpmyadmin folders from C:\xampp\mysql\data_old)
  5. Finally copy the ibdata1 file from C:\xampp\mysql\data_old and replace it inside C:\xampp\mysql\data folder

Now Start MySQL from XAMPP control panel

This helps me!!

Comments

0

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.

Comments

0

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.

3 Comments

That did not help me with the same problem.
Don't delete ibdata1, You will have to copy data from backup and at that you will need this file to restore your database.
Not working any other solution?
0

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.

Comments

0

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.

Comments

0

In my case : I have just replaced

....xampp/mysql/backup files 

into

**xampp/mysql/data**

It worked for me.

Comments

0

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

Comments

0

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


Comments

0

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

2 Comments

adding explanation to your answer will help
Create a folder in any drive where you can copy all files of mysql->data folder, then clean the data folder and restart mysql from xampp control panel ,. Then move all folders only not files from your copy folder to mysql->data folder and move files ib_logfile0, ib_logfile1 , ibdata1 from copy folder to data folder so your databases and tables and table's data is available in phpmyadmin
0

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

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

1 Comment

0

Before trying the above methods, try deleting all aria_log.00000XXX files. It worked for me and I didn't had to cut paste any files

Comments

0

There might be other reasons. See mysql_error.log file. Here is a part of my log file:

2024-11-25  1:49:02 0 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10048: Only one usage of each socket address (protocol/network address/port) is normally permitted.
2024-11-25  1:49:02 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?

The problem was the port. I had another program that was running in port 3306. I free the port and it works. In windows terminal, you can free the port as follows:

> netstat -ano | findstr :3306
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       3296
  TCP    [::]:3306              [::]:0                 LISTENING       3296
> taskkill /pid 3296 /F
SUCCESS: The process with PID 3296 has been terminated.

Comments

0

Working solution in 2024!

Caution! Don't delete ibdata1 file, otherwise You will broke all your installations, then all websites will require a new WordPress installation!

Just follow these steps and its done.

Rename the folder C:\xampp\mysql\data to C:\xampp\mysql\data_old (you can use any name)

Create a new folder C:\xampp\mysql\data

Copy the content that resides in C:\xampp\mysql\backup to the new C:\xampp\mysql\data folder

Copy all your database folders that are in C:\xampp\mysql\data_old to C:\xampp\mysql\data (skip the mysql, performance_schema, and phpmyadmin folders from C:\xampp\mysql\data_old)

Finally copy the ibdata1 file from C:\xampp\mysql\data_old and replace it inside C:\xampp\mysql\data folder

Now Start MySQL from XAMPP control panel

Notes to be taken from this solution:

The ibdata1 file is crucial for InnoDB tables, so make sure you don't delete it.
This method ensures that all your database files are preserved and operational.

If MySQL still doesn't start, check if the port 3306 is blocked by another application or update the port number in your my.ini file.

Hopefully, this solves the issue in late 2024. Let me know if you face any other problems!

Comments

0

The simplest and most definitive solution I found was this:

  1. Back up your XAMPP folder.
  2. Completely delete the XAMPP folder.
  3. Reinstall XAMPP using the installation tool.
  4. Copy your data from the htdocs folder in your backup to the newly installed XAMPP folder.
  5. Go to the mysql/data folder and compare the files to find out which one contains your database you can check by file size. (For me, it was ibdata1).
  6. Copy only this file to your new XAMPP installation.

This solution worked for me. My first step after that was to export my databases as SQL files using phpMyAdmin, and then I proceeded accordingly.

However, keep in mind that this solution will erase all other configurations you made in XAMPP. In my case, I didn't have anything else important. If you have other important files, you may try restoring them from your backup as well.

Comments

-1

I would simply try reinstalling XAMPP.

Comments

-4

just run your xammp as an administrator, it works

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.