MySQL won’t start because it can’t find thesql-bin.000006 (Errcode 2), how to fix this

amppsMySQLosx-mountain-lion

MySQL (part of AMPPS) suddenly stopped working. Looking at mysql.err it says it can't start because it cannot find mysql-bin.000006 (error 2).

Here is the full log from mysql.err:

130401 17:00:47 InnoDB: The InnoDB memory heap is disabled
130401 17:00:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130401 17:00:47 InnoDB: Compressed tables use zlib 1.2.3
130401 17:00:47 InnoDB: Initializing buffer pool, size = 128.0M
130401 17:00:47 InnoDB: Completed initialization of buffer pool
130401 17:00:47 InnoDB: highest supported file format is Barracuda.
130401 17:00:49  InnoDB: Waiting for the background threads to start
130401 17:00:50 InnoDB: 1.1.8 started; log sequence number 193114266
/Applications/AMPPS/mysql/bin/mysqld: File './mysql-bin.000006' not found (Errcode: 2)
130401 17:00:50 [ERROR] Failed to open log (file './mysql-bin.000006', errno 2)
130401 17:00:50 [ERROR] Could not open log file
130401 17:00:50 [ERROR] Can't init tc log
130401 17:00:50 [ERROR] Aborting

130401 17:00:50  InnoDB: Starting shutdown...
130401 17:00:50  InnoDB: Shutdown completed; log sequence number 193114266
130401 17:00:50 [Note] /Applications/AMPPS/mysql/bin/mysqld: Shutdown complete

Here is the directory where all the binary log files live:

drwx------  128 cyberskull  admin      4352 Mar 31 02:46 redacted
-rw-rw----    1 cyberskull  admin   5242880 Apr  1 17:00 ib_logfile0
-rw-rw----    1 cyberskull  admin   5242880 Mar 31 02:46 ib_logfile1
-rw-rw----    1 cyberskull  admin  44040192 Apr  1 17:00 ibdata1
drwxr-xr-x@  74 cyberskull  admin      2516 Jan 30 22:31 mysql
-rw-rw----    1 cyberskull  admin   2053929 Mar 18 23:18 mysql-bin.000001
-rw-rw----    1 cyberskull  admin  44002874 Mar 23 19:40 mysql-bin.000002
-rw-rw----    1 cyberskull  admin  25182139 Mar 25 20:59 mysql-bin.000003
-rw-rw----    1 cyberskull  admin  21533910 Mar 28 19:51 mysql-bin.000004
-rw-rw----    1 cyberskull  admin  32820396 Mar 29 18:45 mysql-bin.000005
-rw-rw----    1 cyberskull  admin       114 Mar 30 14:33 mysql-bin.index
-rw-rw----@   1 cyberskull  admin    114303 Apr  1 17:00 mysql.err
drwxr-xr-x@  20 cyberskull  admin       680 Jan 30 22:31 performance_schema
drwxr-xr-x@   2 cyberskull  admin        68 Jan 30 22:31 test

What do I have to do to get MySQL up and running again?

Best Answer

OPTION #1

Just move the binary logs aside and start mysql

mv mysql-bin.* ..

Then, startup mysql

OPTION #2

Edit the file mysql-bin.index and remove the line that has mysql-bin.0000006

Then, startup mysql

Give it a Try !!!

Related Question