<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Eschew Obfuscation: MySQL Recovery</title>
    <link>http://blog.maxdunn.com/articles/2007/03/05/mysql-recovery</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Max Dunn's Personal Blog</description>
    <item>
      <title>MySQL Recovery</title>
      <description>&lt;p&gt;We had a bad crash yesterday on our MySQL 5.0.22 database. Our guess is that we ran out of hard disk space during a large transaction and the database somehow got corrupted. Worse, restarting MySQL didn&amp;#8217;t clear the error, but continued to have the problem. Luckily, we could still read from the database so we were able to do a current backup which allowed us to recreate the database and re-import the data. Here are the steps we used:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;In my.conf use:&lt;br&gt;
     &lt;code&gt;innodb_force_recovery = 6&lt;/code&gt;&lt;br&gt;
  (or lower) to bring the database up.&lt;br&gt;
   (See http://www.mysql.org/doc/refman/5.1/en/forcing-recovery.html)&lt;/li&gt;
		&lt;li&gt;Dump the tables. For example. to dump the &amp;#8216;maxwiki&amp;#8217; table use:&lt;br&gt;
  &lt;code&gt;
  mysqldump -
   mysqldump --database maxwiki -u (username) -p (password) &amp;gt; maxwiki.sql
  &lt;/code&gt;&lt;br&gt;
  Repeat for all other tables&lt;/li&gt;
		&lt;li&gt;Shut down the database&lt;/li&gt;
		&lt;li&gt;Move all files out of /usr/bin/mysql and put elsewhere&lt;/li&gt;
		&lt;li&gt;Re-init with:&lt;br&gt;
   &lt;code&gt;&lt;pre&gt;
  mysqld_safe --user=mysql
  mysql_install_db --user=mysql
  mysqladmin -u (username) password '(password)'
 &lt;/pre&gt;&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Reload all the tables from the sql files&lt;/li&gt;
		&lt;li&gt;Reset the users&lt;/li&gt;
	&lt;/ol&gt;</description>
      <pubDate>Mon, 05 Mar 2007 08:57:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:9f23cc78-1784-4ffd-bfef-d2d9f086d456</guid>
      <author>Max Dunn</author>
      <link>http://blog.maxdunn.com/articles/2007/03/05/mysql-recovery</link>
      <category>Tech Tips</category>
    </item>
    <item>
      <title>"MySQL Recovery" by Florian</title>
      <description>&lt;p&gt;Hey Max!&lt;/p&gt;


	&lt;p&gt;Have you ever tried to click the link &amp;#8220;Valid XHTML 1.0&amp;#8221; in the footer of your blog? :-)
It does not seem sooo valid&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Florian&lt;/p&gt;</description>
      <pubDate>Sat, 10 Mar 2007 04:09:50 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:40119bb6-39e0-4def-8523-61c6c9dd7aac</guid>
      <link>http://blog.maxdunn.com/articles/2007/03/05/mysql-recovery#comment-212</link>
    </item>
  </channel>
</rss>
