Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqld.exe: Table '.\mysql\db' is marked as crashed and should be repaired

Tags:

mysql

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?

like image 430
knot22 Avatar asked Oct 15 '19 02:10

knot22


People also ask

Why MySQL table is marked as crashed?

The cause behind the errorWhen you have low space on your disk, some of the tables in the database may get crashed. It usually happens when you get space issues on the part of the hard disk where your database is stored. Often it gets difficult to identify the specific tables that are affected by the error.

Is marked as crashed and should be repaired in?

The MySQL error “MySQL is marked as crashed and should be repaired” may occur suddenly while you are accessing MySQL. The frequency of the error is more after the forced shutdowns of the MySQL Server. Whatever be the reason, you cannot access or use your MySQL tables anymore as it has been completely crashed.

Is marked as crashed and last repair failed?

MySQL Table is marked as crashed and last (automatic?) Repair failed?. The error can be caused due to many reasons including zero disk space available on the server, a hard reset of server, forced shutdown of MySQL, or MySQL process crashing due to some reason.


1 Answers

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

like image 148
Ashfaq Avatar answered Sep 19 '22 12:09

Ashfaq