title: MariaDB crash: Table doesn't exist in engine && can't recover tables
body: <p>I'm running:</p>
  
  <pre><code>MariaDB 10.0.5
  Ubuntu 12.04 LTS
  Both up to the latest patch level as per last Friday
  </code></pre>
  
  <p>I've gotten into quite a pickle with a previous issue:</p>
  
  <pre><code>http://stackoverflow.com/questions/19910996/mysql-connect-headers-and-client-library-minor-version-mismatch-library10000
  </code></pre>
  
  <p>This has resulted in massive corruption because I copied &amp; removed my ibdata1, ib_logfile0 and ib_logfile1 in order to solve a symptom of the above problem. This issue began, I think, when I next started the mariadb service. When I try to select one of the affected tables or run a mysqldump I get the following:</p>
  
  <pre><code>mysqldump -u backupusr -p'somepass' --all-databases &gt; dump.sql
  
  mysqldump: Got error: 1932: "Table 'some_db.dw_commentmeta' doesn't exist in engine" when using LOCK TABLES
  </code></pre>
  
  <p>Luckily (EXTREMELY luckily) the data of my big production client website is still intact and the site is online. Though there is at least one corrupt table in that DB too. Now to recover all of my other websites' databases. </p>
  
  <p>I've still got the original ibdata1, ib_logfile0 and ib_logfile1 files. When I move these files back to /var/lib/mysql/ the mariaDB service fails to start.</p>
  
  <p>One of the things I've tried is forcing an InnoDB recovery as per:</p>
  
  <pre><code>http://dev.mysql.com/doc/refman/5.0/en/forcing-innodb-recovery.html
  </code></pre>
  
  <p>But that has no effect. After that I tried force-using the Mysql upgrade tool to see if it could repair the tables:</p>
  
  <pre><code>mysql_upgrade --password --force
  FATAL ERROR: Upgrade failed
  </code></pre>
  
  <p>So that doesn't tell me anything. Next I've used the REPAIR TABLE &amp; ALTER TABLE ENGINE commands:</p>
  
  <pre><code>http://dev.mysql.com/doc/refman/5.0/en/rebuilding-tables.html
  </code></pre>
  
  <p>Alter engine:</p>
  
  <pre><code>MariaDB [sictnl_db]&gt; ALTER TABLE si_users ENGINE = MyISAM;
  ERROR 1932 (42S02): Table 'sictnl_db.si_users' doesn't exist in engine
  </code></pre>
  
  <p>repair table:</p>
  
  <pre><code>MariaDB [sictnl_db]&gt; REPAIR TABLE si_users;
  +--------------------+--------+----------+----------------------------------------------------+
  | Table              | Op     | Msg_type | Msg_text                                           |
  +--------------------+--------+----------+----------------------------------------------------+
  | sictnl_db.si_users | repair | Error    | Table 'sictnl_db.si_users' doesn't exist in engine |
  | sictnl_db.si_users | repair | status   | Operation failed                                   |
  +--------------------+--------+----------+----------------------------------------------------+
  2 rows in set (0.00 sec)
  </code></pre>
  
  <p>So this all boils down to getting the table information back into the engine's tables. The documentation at <a href="https://mariadb.com/kb/en/mariadb-storage-engines/" rel="noreferrer">https://mariadb.com/kb/en/mariadb-storage-engines/</a> states that there are two storage engines either of which I'm using per default:</p>
  
  <pre><code>Aria
  MyISAM
  </code></pre>
  
  <p>When performaning the SHOW CREATE TABLE function on one of the uncorrupted tables I get the following:</p>
  
  <pre><code>ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 |
  </code></pre>
  
  <p>So MyISAM it is, googling 'mysql repair myisam' leads me to the following site:</p>
  
  <pre><code>Note: Would Aria have protected me against this issue?
  
  http://dev.mysql.com/doc/refman/5.0/en/myisamchk.html
  </code></pre>
  
  <p>This yields me the myisamchk command, which needs to be pointed to the local storage of the tables like so:</p>
  
  <pre><code>myisamchk /var/lib/mysql/sictnl_db/*
  
  
  myisamchk: error: '/var/lib/mysql/sictnl_db/db.opt' is not a MyISAM-table
  ---------
  myisamchk: error: '/var/lib/mysql/sictnl_db/si_commentmeta.frm' is not a MyISAM-table
  ---------
  myisamchk: error: '/var/lib/mysql/sictnl_db/si_commentmeta.ibd' is not a MyISAM-table
  </code></pre>
  
  <p>So the tool seems to be missing the .MYI files, but these files don't exist  in the shell.</p>
  
  <p>I'm posting this now to see whether you've got any helpful comment, Ill continue my analysis in the mean time and update the post should I get any further.</p>
  
  <p>Thanks in advance!</p>