Sandeep Developer
Sandeep Developer

Reputation: 13

How to solve "Error: MySQL shutdown unexpectedly" In Xamp?

When I open XAMPP and click start MySQL button and it gives me an error. I had started it just before, but now it isn't working.

It given error below in xammp

Error: MySQL shutdown unexpectedly.
This may be due to a blocked port, missing dependencies, 
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums

Here is the contents of the error log:


2022-03-05 11:17:33 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2022-03-05 11:17:33 0 [Note] InnoDB: Uses event mutexes
2022-03-05 11:17:33 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-03-05 11:17:33 0 [Note] InnoDB: Number of pools: 1
2022-03-05 11:17:33 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-03-05 11:17:33 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2022-03-05 11:17:33 0 [Note] InnoDB: Completed initialization of buffer pool
2022-03-05 11:17:36 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2022-03-05 11:17:36 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-03-05 11:17:36 0 [Note] InnoDB: Setting file 'D:\xamp_7.2\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-03-05 11:17:36 0 [Note] InnoDB: File 'D:\xamp_7.2\mysql\data\ibtmp1' size is now 12 MB.
2022-03-05 11:17:36 0 [Note] InnoDB: Waiting for purge to start
2022-03-05 11:17:36 0 [Note] InnoDB: 10.4.13 started; log sequence number 5683247830; transaction id 653050
2022-03-05 11:17:36 0 [Note] InnoDB: Loading buffer pool(s) from D:\xamp_7.2\mysql\data\ib_buffer_pool
2022-03-05 11:17:36 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-03-05 11:17:36 0 [Note] InnoDB: Buffer pool(s) load completed at 220305 11:17:36
2022-03-05 11:17:36 0 [Note] Server socket created on IP: '::'.

What is the cause of these errors and how can I rectify them?

Upvotes: 0

Views: 23837

Answers (7)

Inzam Ulhaq
Inzam Ulhaq

Reputation: 7

simple steps to resolve it without changing the default port 3306:

  1. Try to restart XAMPP. If that doesn't work, then proceed to #2.
  2. Open task manager and search for MySQL
  3. Click end the task
  4. Restart XAMPP

Upvotes: -1

ravina vala
ravina vala

Reputation: 129

Changing port in my.ini works fine

  1. Go to the directory: C:\xampp\mysql\data and delete the following files:

enter image description here

  1. After that, go to the directory C:\xampp\mysql\bin and open my.ini in a text editor. It will look like this:

comment default #port=3306, add port=81 enter image description here

  1. MySQL server is running on a port other than the default 3306, you must explicitly tell phpMyAdmin which port to use in the configuration file (config.inc.php).

Path: C:\xampp\phpMyAdmin\config.inc.php

Add the port that you're using for MySql

$cfg['Servers'][$i]['port'] = '81';
  1. if PHP installations us default to MySQL on port 3306.

Search for the line related to MySQL defaults in php.ini

mysqli.default_port = 3306

If you find it, change it to match your MySQL port:

eg. mysqli.default_port = 81 Save the file and restart your web server (Apache).

Upvotes: 0

Akam Barznji
Akam Barznji

Reputation: 425

1.Menu Config → Apache → Open httpd.conf. Search for Listen or 80, and update the listen port to 8081. Save and restart the server.

2.Ctrl + Alt + Del End task mysqld Restart MySQL enter image description here

3.Xampp stop Instantly after start.

copy all files and folder from C:\xampp\mysql\backup and paste into C:\xampp\mysql\data.

enter image description here

Upvotes: 0

gwendal
gwendal

Reputation: 141

For me, open and empty the file multi-master.info which is at the base of folder data is enough for me.

Upvotes: 14

krishna
krishna

Reputation: 92

Open data folder and delete all ib_logfile* (ib_logfile0, ib_logfile1). Then restart xamp, so it solved for me.

Reference: https://community.apachefriends.org/f/viewtopic.php?t=82071&p=276632

Upvotes: 3

stefacuartas
stefacuartas

Reputation: 1

Fix this error with just 2 steps:

  • Task Manager
  • Find MySQL -> end task Go back to XAMPP -> star MySQL, port 3306 should work again.

If you do this it is possible that some DB that you are also using in that port will be deleted, make sure you have a copy before proceeding.

Upvotes: 0

Snaville
Snaville

Reputation: 39

There are several causes to this problem, and here are some solutions:

  1. Change Your MySQL Port

One of the main causes of this error “MySQL shutdown unexpectedly” is another software using the port assigned to MySQL which is 3306. To verify this you can use netstat module from XAMPP’s control panel, right above the Shell tool. You can fix this problem and prevent it from repeating in the future by simply changing mysql port. To change it, do the following:

  • Click Confing found at the top right corner
  • Click Services and Port Settings
  • Select MySQL then change 3306 to 3307 then click save
  • On the main xammp screen, Click on mysql's config then select my.ini then search and replace 3306 with the new port number used, in our case 3307 then save
  • Restart xampp then the problem is solved! But if your problem is not solved, proceed to solution number 2 below
  1. Restore Your Database Backup

Onother reason for this error is corrupted database, to fix it simply restore your database backup which is created automatically by xampp. By default, your XAMPP MySQL backup files should be under Local Disk > XAMPP > MySQL. Inside that directory, you’ll see several folders, two of which are called data and backup. he data folder includes all of the files that your database uses. The backup folder contains a single recent copy of your MySQL. To restore the MySQL backup, change the name of the data folder to anything else, such as data-old. Then rename the backup folder to data. That’s it!

Upvotes: 1

Related Questions