9

The MySQL service will no longer start on my XAMPP installation on a Windows 10 machine. The error message in the XAMPP console says:

Error: MySQL shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method.

The error log shows this:

InnoDB: using atomic writes.
2019-10-14 20:43:47 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-10-14 20:43:47 0 [Note] InnoDB: Uses event mutexes
2019-10-14 20:43:47 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-10-14 20:43:47 0 [Note] InnoDB: Number of pools: 1
2019-10-14 20:43:47 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-10-14 20:43:47 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2019-10-14 20:43:47 0 [Note] InnoDB: Completed initialization of buffer pool
2019-10-14 20:43:48 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-10-14 20:43:48 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-10-14 20:43:48 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-10-14 20:43:48 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2019-10-14 20:43:48 0 [Note] InnoDB: 10.4.6 started; log sequence number 6899920; transaction id 13408
2019-10-14 20:43:48 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2019-10-14 20:43:48 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-10-14 20:43:48 0 [Note] Server socket created on IP: '::'.

And the Windows Event Viewer contains 5 separate error messages:

mysqld.exe: Table '.\mysql\db' is marked as crashed and should be repaired
mysqld.exe: Index for table '.\mysql\db' is corrupt; try to repair it
Couldn't repair table: mysql.db
Fatal error: Can't open and lock privilege tables: Index for table 'db' is corrupt; try to repair it
Aborting

When an attempt is made to connect to MySQL, it doesn't work (which makes sense because the MySQL service will not run). This is the error message given in CMD after an attempt is made to connect: ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061).

Posts related to MySQL tables that need to be repaired require connecting to MySQL so they do not help in this situation. If it's possible to repair mysql.db on a Windows 10 machine without connecting to MySQL, what are the steps to do so?

knot22
  • 2,648
  • 5
  • 31
  • 51
  • 1
    Does this answer your question? [XAMPP MySQL service crash after reboot](https://stackoverflow.com/questions/56847804/xampp-mysql-service-crash-after-reboot) – user207421 Mar 07 '20 at 11:24

1 Answers1

37

This one helped for me:

Open shell from from control panel and start mysql with this command:

mysqld –-console –-skip-grant-tables –-skip-external-locking

Open another shell from control panel and repair database with this command:

mysqlcheck -r --databases mysql --use-frm

Stop mysql, close shells and restart mysql normally.

Posted in following: https://stackoverflow.com/a/57001732

Community
  • 1
  • 1
Ashfaq
  • 371
  • 3
  • 3
  • I am getting this error = note : The storage engine for the table doesn't support repair – Thirsty Six Jun 01 '22 at 05:16
  • @ThirstySix its not an error, just a warning stating some tables can't repair because those tables are required for the working of mysql. – Aflah vp Feb 16 '23 at 05:08