<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5008207950629780251</id><updated>2024-09-13T09:00:54.798-07:00</updated><title type='text'>Mysql Trouble shooting</title><subtitle type='html'>This blog basically deals with the how to troubleshoot the   problems related to the mysql.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-7805591830063835247</id><published>2012-02-19T23:03:00.001-08:00</published><updated>2012-02-19T23:03:59.034-08:00</updated><title type='text'>MySQL Backup Strategy.</title><content type='html'>&lt;div&gt;Back up Strategies&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you are admin taking the backup is really an important task in light of MySQL you should do the following&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Take the Backup regularly(weekly,regularly as you wish).Store the Back-up in some safe place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Keep the binary logging enabled so that changes can be recorded in it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. While taking the backup flush the logs so that it generates the new binary log which record the changes after the backup is made.The Syntax is as&lt;/div&gt;&lt;div&gt;mysqldump -uuser -psecret --flush-logs --lock-all-tables --all-databases &amp;gt; dump.sql&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;use the other options with mysqldump if you need&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;--flush-logs &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;: will generate new binary log before which the all dump will be generated.&lt;/div&gt;&lt;div&gt;--lock-all-tables &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;: will lock all tables upto the time till the dump is being generated.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Keep binary logs in some safe place so in case of some failure you can use the most recent backup&#39;s and the binary logs generated after that to reach to the actual level of the database.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/7805591830063835247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2012/02/mysql-backup-strategy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/7805591830063835247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/7805591830063835247'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2012/02/mysql-backup-strategy.html' title='MySQL Backup Strategy.'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-6119268000491623338</id><published>2012-02-08T01:01:00.000-08:00</published><updated>2012-02-08T01:06:22.398-08:00</updated><title type='text'>How to recover a currupted InnoDB table.</title><content type='html'>I was really in Problem when one of my InnoDB table get corrupted I posted My Question on &lt;a href=&quot;http://dba.stackexchange.com&quot;&gt;dba.stackexchange.com.&lt;/a&gt;&lt;br /&gt;The issue was as&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; City&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;-------------------+-------+----------+----------------------------------------------------------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;Table&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;             &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Op    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Msg_type &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Msg_text                                                 &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;-------------------+-------+----------+----------------------------------------------------------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; world_innodb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;City &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Error    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Incorrect information &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;./world_innodb/City.frm&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; world_innodb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;City &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; error    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Corrupt                                                  &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;-------------------+-------+----------+----------------------------------------------------------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; rows &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0.00&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; sec&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then I Created a test scenario and found solution&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;post-text&quot;&gt;&lt;p&gt;I created a table called test2 &lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; int&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; ENGINE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;InnoDB &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CHARSET&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;latin1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;I then inserted one record &lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;insert&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;into&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; test2 &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;I stopped MySQL and then added a bunch of characters to the test2.frm file with vi.&lt;/p&gt;  &lt;p&gt;I then started MySQL and saw the following &lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; show &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;G&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;***************************&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; row &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;***************************&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;           Name&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; test2&lt;br /&gt;         Engine&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;        Version&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;     Row_format&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;           Rows&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Avg_row_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Data_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;Max_data_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;   Index_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;      Data_free&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Auto_increment&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Create_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Update_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;     Check_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;      Collation&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;       Checksum&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Create_options&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;        Comment&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Incorrect information &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;./test2/test2.frm&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;I then created another table with the same structure&lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;CREATE&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;TABLE&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; int&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; ENGINE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;InnoDB &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;DEFAULT&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; CHARSET&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;latin1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;I then stopped mysql and copied test3.frm over test2.frm&lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;cp &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;testdb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;test3&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;frm &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;testdb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;test2&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;frm&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;I restarted MySQL and had access to test2&lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; show &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; status &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;G&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;***************************&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; row &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;***************************&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;           Name&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; test2&lt;br /&gt;         Engine&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; InnoDB&lt;br /&gt;        Version&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;     Row_format&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; Compact&lt;br /&gt;           Rows&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Avg_row_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;16384&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Data_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;16384&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;Max_data_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;   Index_length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;      Data_free&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;25675431936&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Auto_increment&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Create_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2012-02-07&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    Update_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;     Check_time&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;      Collation&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; latin1_swedish_ci&lt;br /&gt;       Checksum&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt; Create_options&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;        Comment&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;Here is the record that I inserted&lt;/p&gt;  &lt;pre class=&quot;lang-sql prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; test2&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; t    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;------+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; row &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0.00&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; sec&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;  &lt;p&gt;If you know the structure of the table &lt;strong&gt;City&lt;/strong&gt; , you could create an identical table and then copy the .frm file over the existing corrupted one&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/6119268000491623338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2012/02/how-to-recover-currupted-innodb-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/6119268000491623338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/6119268000491623338'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2012/02/how-to-recover-currupted-innodb-table.html' title='How to recover a currupted InnoDB table.'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-7509776624389486877</id><published>2011-12-01T20:57:00.001-08:00</published><updated>2011-12-01T21:00:12.888-08:00</updated><title type='text'>Step by step process for how to set the mk-heartbeat monitoring</title><content type='html'>&lt;div&gt;&lt;b&gt;Process For setting mk-heartbeat mechanism.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Take a case you have two servers(Master and Slave1 and Slave2)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;replication is as Master-&amp;gt;Slave&lt;/div&gt;&lt;div&gt;We want to set monitoring for slave.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Steps:&lt;/div&gt;&lt;div&gt;&lt;b&gt;1.&lt;/b&gt;Download mk-heartbeat script&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;from terminal you can download as:&lt;/div&gt;&lt;div&gt;&lt;b&gt;wget http://www.maatkit.org/get/mk-heartbeat &lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2.&lt;/b&gt;create a database Heartbeat and a table heartbeat on the master.It will automatically be replicated on the slave.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;create database Heartbeat;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;use Heartbeat;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;CREATE TABLE heartbeat (&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;    id int NOT NULL PRIMARY KEY,&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;    ts datetime NOT NULL&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;)Engine = Memory;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Insert one row in the table heartbeat as&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;INSERT INTO heartbeat (id, ts) VALUES (1, NOW());&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;If the user has permissions on the Heartbeat we dont need to insert the row manually in the table,The mk-heartbeat will itself insert the row in it.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;3.&lt;/b&gt;Now create a user heartbeat with some password as&lt;/div&gt;&lt;div&gt;&lt;b&gt;Grant all on Heartbeat.* to heartbeat@&#39;%&#39; identified by &#39;maatkit&#39;;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;the user heartbeat should have permissions on the Database Heartbeat, We have created the user heartbeat for our sake otherwise we have to start mk-heartbeat by any other or current user.mk-heartbeat takes the default values from the my.cnf it did not pass them at the script execution time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4.Now we have to make mk-heartbeat to update the master and monitor the slave.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For master:&lt;/div&gt;&lt;div&gt;&lt;b&gt;mk-heartbeat -D Heartbeat --update -h 10.167.29.58 -u heartbeat -p maatkit --daemonize&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;where 10.167.29.58  is IP for master&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For Slave:&lt;/div&gt;&lt;div&gt;&lt;b&gt;mk-heartbeat -D Heartbeat --monitor -h 10.166.162.231 -u heartbeat -p maatkit --daemonize --log /home/slave.log&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;where 10.166.162.231 is IP for slave.&lt;/div&gt;&lt;div&gt;It will generate the log in slave.log file generated by above command  &lt;/div&gt;&lt;div&gt;Issue &lt;b&gt;tail -f  slave.log&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It should be working fine.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/7509776624389486877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/12/step-by-step-process-for-how-to-set-mk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/7509776624389486877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/7509776624389486877'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/12/step-by-step-process-for-how-to-set-mk.html' title='Step by step process for how to set the mk-heartbeat monitoring'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-9085035873561512253</id><published>2011-10-17T04:11:00.000-07:00</published><updated>2011-10-17T04:12:21.611-07:00</updated><title type='text'>MySQL replication set up</title><content type='html'>&lt;div&gt;there are some basic steps to set mysql replication.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;wee start from MASTER&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1.see that binary logs are enabled.and also set server id in my.cnf file&lt;/div&gt;&lt;div&gt;If not then do as:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;log-bin=mysql-bin  ##THIS SHOULD BE THE SAME AS HERE &lt;/div&gt;&lt;div&gt;server-id=1&lt;/div&gt;&lt;div&gt;Restart the server&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2.in the mysql shell issue a command&lt;/div&gt;&lt;div&gt;mysql &amp;gt; show binary logs;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If the binary logs are enabled it should not return the empty result set.If return empty set you are wrong somewhere pls check that step 1 is completed...??&lt;/div&gt;&lt;div&gt;otherwise you will face problem in replication&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If done come to step 3.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3.In mysql shell write&lt;/div&gt;&lt;div&gt;mysql &amp;gt; FLUSH TABLES WITH READ LOCK;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now just generate the dump of your master as or any other method u want&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;mysqldump -uroot -proot --all-databases --master-data &amp;gt; dbdump.db&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. mysql &amp;gt; show master status;&lt;/div&gt;&lt;div&gt;note down the binary log and position.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5.now In mysql shell&lt;/div&gt;&lt;div&gt;mysql &amp;gt; UNLOCK TABLES;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;6.mysql &amp;gt; CREATE USER &#39;repl&#39;@ &#39;%&#39;  IDENTIFIED BY &#39;password&#39;;&lt;/div&gt;&lt;div&gt;GRANT REPLICATION SLAVE ON *.* TO &#39;repl&#39;@ &#39;%&#39;  IDENTIFIED BY &#39;password&#39;;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;NOW ON THE SLAVE DO SOME WORK&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1.IN my.cnf&lt;/div&gt;&lt;div&gt;server-id=2&lt;/div&gt;&lt;div&gt;#and also try to  write relay-log&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;restart the mysql server&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2.&lt;/div&gt;&lt;div&gt;mysql &amp;gt; stop slave;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;mysql &amp;gt; CHANGE MASTER TO&lt;/div&gt;&lt;div&gt;MASTER_HOST=’X.X.X.X’,&lt;/div&gt;&lt;div&gt;MASTER_USER=’user’,&lt;/div&gt;&lt;div&gt;MASTER_PASSWORD=’password’,&lt;/div&gt;&lt;div&gt;MASTER_PORT=3306,&lt;/div&gt;&lt;div&gt;MASTER_LOG_FILE=’mysql-bin.000001?,&lt;/div&gt;&lt;div&gt;MASTER_LOG_POS=98,&lt;/div&gt;&lt;div&gt;MASTER_CONNECT_RETRY=10;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;mysql &amp;gt; start slave ;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;mysql &amp;gt; show slave status\G&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now It should be working fine&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/9085035873561512253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/10/mysql-replication-set-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/9085035873561512253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/9085035873561512253'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/10/mysql-replication-set-up.html' title='MySQL replication set up'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-287252504822821637</id><published>2011-10-12T22:36:00.001-07:00</published><updated>2011-10-12T23:14:47.333-07:00</updated><title type='text'>MySQL startup issue</title><content type='html'>&lt;p style=&quot;margin-bottom: 0cm&quot;&gt;If you are facing problem in starting the mysql server try to start mysqld with the option –verbose it will tell what is  the problem or you can also check the problem by your error log file.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Take a case here  &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;b&gt;abdul@system:~$ mysqld --verbose   --user=mysql –datadir=/var/lib/mysql/ &amp;amp;&lt;/b&gt; &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;[1] 2975 &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;abdul@system:~$ 111013 10:42:35 [Warning] &#39;--log_slow_queries&#39; is deprecated and will be removed in a future release. Please use &#39;&#39;--slow_query_log&#39;/&#39;--slow_query_log_file&#39;&#39; instead. &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;111013 10:42:35 [Warning] Can&#39;t create test file /var/lib/mysql/OSS-240.lower-test &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;111013 10:42:35 [Warning] Can&#39;t create test file /var/lib/mysql/OSS-240.lower-test &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;mysqld: Can&#39;t change dir to &#39;/var/lib/mysql/&#39; (Errcode: 13) &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;111013 10:42:35 [ERROR] Aborting &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt; &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;111013 10:42:35 [Note] mysqld: Shutdown complete &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Above wee see that we are getting error code 13.means its permission issue login as root and now try.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; background: #ffffff&quot;&gt;&lt;span style=&quot;text-decoration: none&quot;&gt;&lt;b&gt;&lt;a href=&quot;mailto:root@OSS-240&quot;&gt;root@&lt;/a&gt;system&lt;/b&gt;&lt;/span&gt;&lt;b&gt;:~$&lt;/b&gt;&lt;b&gt;mysqld --verbose --user=mysql --datadir=/var/lib/mysql/   &amp;amp;&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; background: #ffffff&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;now mysql is running  &amp;amp; working  properly.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;But one point you should consider in mind is that we have written  –user=mysql.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Always try to start your mysql server as mysql user if you start it as root its not a good practice.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/287252504822821637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/10/mysql-startup-issue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/287252504822821637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/287252504822821637'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/10/mysql-startup-issue.html' title='MySQL startup issue'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-2161802696738211967</id><published>2011-10-11T03:42:00.000-07:00</published><updated>2011-10-11T03:43:23.965-07:00</updated><title type='text'>Restore your data using mysqlbinlogs</title><content type='html'>&lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;b&gt;Its a simple article on How you can restore your data using mysql binary logs.&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;mysql binary logs   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;ontain a record of each SQL query executed against the database that changes data since the logs where last flushed (new log file started).MySQL Binary Logs must be enabled by passing the –log-bin option to mysqld.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;The log contains queries like UPDATE and DELETE. The log does &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;em&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;&lt;span style=&quot;font-style: normal&quot;&gt;not &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;record SELECT or SHOW queries for example because they do not change the database.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;MySQL Binary Logs are some times confused with the InnoDB binary transaction log. InnoDB uses a binary log to journal changes to the InnoDB table space file(s) as a protection from crashes to protect table space data integrity.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;When --log-bin is enabled even InnoDB transactions are written to the binary transaction log used for replication or restores.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;At this time take a scenario you has binary logs as follows:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;see the location where binary logs are stored.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000001&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span style=&quot;font-family: Times, serif; font-size: medium; &quot;&gt;localhost-bin.000002&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000003 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.index&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;firstly lock the tables as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;LOCK TABLES &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;then flush the logs &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;FLUSH LOGS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;At this time take a scenario you has binary logs as follows: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;see the location where binary logs are stored.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000001 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000002 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000003 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.00000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.index&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;after flushing the logs a new bianry log generated as &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.00000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;4.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;Now &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;upto &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;binary log &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000003 &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;you can take the complete backup.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;take the backup using any method that you want.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt; &lt;span &gt;&lt;span &gt;&lt;span &gt;This is you complete backup upto the &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;log &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;localhost-bin.000003&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;Then unlock the tables &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;as &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt; &lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;UNLOCK TABLES &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;Restoring with Binary Logs&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-top: 0.42cm; margin-bottom: 0.42cm; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; line-height: 0.56cm; &quot;&gt; &lt;span &gt;&lt;span &gt;&lt;span &gt;To restore from a point in time using binary logs you would:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol&gt;  &lt;li&gt;&lt;p style=&quot;margin-bottom: 0cm; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; line-height: 0.56cm; &quot;&gt;  &lt;span &gt;&lt;span &gt;&lt;span &gt;Restore  the database from the last SQL Dump completed before the desired  recovery point.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style=&quot;border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; line-height: 0.56cm; &quot;&gt;  &lt;span &gt;&lt;span &gt;&lt;span &gt;Use   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/mysqlbinlog.html&quot;&gt;mysqlbinlog&lt;/a&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;to  restore to the desired point in timewhere N is the log entry number  you want to restore up to.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;pre class=&quot;western&quot; style=&quot;margin-left: 0.53cm; margin-right: 0.53cm; margin-top: 0.26cm; margin-bottom: 0.26cm; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; line-height: 130%; &quot;&gt;&lt;span &gt;&lt;span &gt;&lt;span &gt;&lt;b&gt;&lt;span style=&quot;background: #ffffff&quot;&gt;mysqlbinlog –start-position=N    localhost-bin.000004   | mysql&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span &gt;&lt;span &gt;&lt;span &gt;&lt;span style=&quot;background: #ffffff&quot;&gt;N is the position of binary log.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/2161802696738211967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/10/restore-your-data-using-mysqlbinlogs.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/2161802696738211967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/2161802696738211967'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/10/restore-your-data-using-mysqlbinlogs.html' title='Restore your data using mysqlbinlogs'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-3958366565380202416</id><published>2011-10-10T22:52:00.000-07:00</published><updated>2011-10-10T22:54:24.036-07:00</updated><title type='text'>How to reduce the ibdata space in Mysql</title><content type='html'>&lt;h2 class=&quot;western&quot; align=&quot;LEFT&quot; style=&quot;font-weight: normal&quot;&gt;Dump the Whole Database&lt;/h2&gt; &lt;p align=&quot;LEFT&quot;&gt;&lt;b&gt;This is the easiest method &lt;/b&gt;&lt;b&gt;How to reclaim the ibdata space&lt;/b&gt;&lt;/p&gt; &lt;p&gt;In fact, this is the method I used to solve the problem. It requires much more space and time but it’s maybe the easiest one. So here it is:&lt;/p&gt; &lt;ol&gt;  &lt;li&gt;&lt;p&gt;Dump all databases by using:&lt;/p&gt;  &lt;blockquote&gt;&lt;b&gt;mysqldump -uroot -proot  --extended-insert   --all-databases  --add-drop-database --disable-keys   --flush-privileges  --quick  --routines  --triggers &amp;gt;  all-databases.sql&lt;/b&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Stop the MySQL server;   &lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;  &lt;b&gt;/&lt;/b&gt;&lt;b&gt;etc/init.d/mysql stop&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;ol start=&quot;3&quot;&gt;  &lt;li&gt;&lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Rename or remove the MySQL data  directory and create an empty one with the same name and  permissions;   &lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;b&gt; &lt;i&gt;i.e &lt;/i&gt;&lt;/b&gt;In case the datadir is /var/lib/mysql then remove the all content of that.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm; &quot;&gt; else remove /var/lib/mysql and create other one with the same permission and same  name.&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;b&gt;  &lt;/b&gt;&lt;/p&gt; &lt;ol start=&quot;4&quot;&gt;  &lt;li&gt;&lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Make the appropriate changes in  &lt;em&gt;&lt;span style=&quot;font-style: normal&quot;&gt;my.cnf.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;ol start=&quot;5&quot;&gt;  &lt;li&gt;&lt;p&gt;Re-initialize the database with the following command.   &lt;/p&gt;  &lt;blockquote&gt;&lt;b&gt;sudo -u root mysql_install_db&lt;/b&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style=&quot;margin-bottom: 0cm&quot;&gt;Start the MySQL server;   &lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;  &lt;b&gt;/&lt;/b&gt;&lt;b&gt;etc/init.d/mysql st&lt;/b&gt;&lt;b&gt;art&lt;/b&gt;&lt;/p&gt; &lt;p style=&quot;margin-bottom: 0cm&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;ol start=&quot;7&quot;&gt;  &lt;li&gt;&lt;p&gt;Get into the ‘&lt;em&gt;mysql&lt;/em&gt;‘ console and type:&lt;/p&gt;  &lt;blockquote&gt;&lt;b&gt;SET FOREIGN_KEY_CHECKS=0;&lt;br /&gt;SOURCE  all-databases.sql;&lt;br /&gt;SET FOREIGN_KEY_CHECKS=1;&lt;/b&gt;&lt;/blockquote&gt;  &lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;b&gt;Restart the MySQL server.&lt;/b&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;b&gt;At this point of time everything should be running fine.&lt;/b&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/3958366565380202416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/10/how-to-reduce-ibdata-space-in-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/3958366565380202416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/3958366565380202416'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/10/how-to-reduce-ibdata-space-in-mysql.html' title='How to reduce the ibdata space in Mysql'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5008207950629780251.post-9053562386332446927</id><published>2011-08-10T23:48:00.000-07:00</published><updated>2011-09-27T04:35:48.100-07:00</updated><title type='text'>Running Multiple Mysql server</title><content type='html'>&lt;span&gt;&lt;span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;The Complete Installation Process is not listed here.You Can take that from official webpage :dev.mysql.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;Just what we have to do is the start the server&lt;span style=&quot;color: rgb(204, 0, 0);&quot;&gt; (mysqld_safe)&lt;/span&gt; with different option&#39;s and also this applies for the client&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;(mysql)&lt;/span&gt;. I have installed the two MySql servers Now i want them to be started with different basedir,datadir,socket etc..&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. I have Installed the One  Mysql Server with the apt-get and other as binary.&lt;br /&gt;2. Install the first one Simply as apt-get install mysql-server.&lt;br /&gt;3. The binary Installation is as from&lt;br /&gt;/usr/local/mysql/support-&lt;wbr&gt;files/$&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;./mysql_install_db  --user=mysql --datadir=/usr/local/mysql/&lt;wbr&gt;data  --basedir=/usr/local/mysql&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Now start the server as running below with options.( mysqld_safe  with the various options) &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;root@administrator-desktop:/&lt;wbr&gt;etc/mysql# ps -ef | grep mysql&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;root      6910  6887  0 15:14 pts/5    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.&lt;wbr&gt;cnf&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;mysql     7005  6910  0 15:14 pts/5    00:00:00 &lt;b&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;/usr/sbin/mysqld --defaults-file=/etc/mysql/my.&lt;wbr&gt;cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/&lt;wbr&gt;administrator-desktop.err --pid-file=/var/lib/mysql/&lt;wbr&gt;administrator-desktop.pid --socket=/var/run/mysqld/&lt;wbr&gt;mysqld.sock --port=3307&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;root      7020  6887  0 15:16 pts/5    00:00:00 mysql -p&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;root      7046  6356  0 15:19 ?        00:00:00 /bin/sh ./mysqld_safe --defaults-file=/etc/mysql/my-&lt;wbr&gt;medium.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/&lt;wbr&gt;data --socket=/tmp/mysql.sock&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;mysql     7150  7046  0 15:19 ?        00:00:00&lt;b style=&quot;color: rgb(255, 0, 0);&quot;&gt; /usr/local/mysql/bin/mysqld --defaults-file=/etc/mysql/my-&lt;wbr&gt;medium.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/&lt;wbr&gt;data --user=mysql --log-error=/usr/local/mysql/&lt;wbr&gt;data/administrator-desktop.err --pid-file=/usr/local/mysql/&lt;wbr&gt;data/administrator-desktop.pid --socket=/tmp/mysql.sock --port=3308&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;root      7220  7193  0 15:20 pts/4    00:00:00 grep mysql&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We also need to edit our my.cnf file for the as we have to start the server with the options of &lt;span style=&quot;color: rgb(0, 0, 102); font-family: arial narrow,sans-serif;&quot;&gt;&lt;b style=&quot;color: rgb(255, 0, 0);&quot;&gt;--defaults-file as it include the socket and port.&lt;br /&gt;The socket and port for both the cnf file should different and also all other datadir, basedir .......&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now run your mysql client with --port and --socket option.&lt;/b&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://navodaya05.blogspot.com/feeds/9053562386332446927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://navodaya05.blogspot.com/2011/08/running-multiple-mysql-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/9053562386332446927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5008207950629780251/posts/default/9053562386332446927'/><link rel='alternate' type='text/html' href='http://navodaya05.blogspot.com/2011/08/running-multiple-mysql-server.html' title='Running Multiple Mysql server'/><author><name>Abdul Manaf</name><uri>http://www.blogger.com/profile/00519942101827275889</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4-TGrS7JqoczdIUp1RT67vUCtbxh0tZQ4oxS4JxtbqPIYtRWuHhNXPn91tLPZ-aEa7rmS38vdNQ8niHt7aD3lSiBcqufBLoh50CK4xubz4YSwbDzxojOfqfovW5up4g/s220/image.jpeg'/></author><thr:total>1</thr:total></entry></feed>