tag:blogger.com,1999:blog-34261534801420413182014-10-06T20:42:20.802-07:00mysql tricksmore more nd more new trickzz about mysql and linux..tushar_sharmaaahttp://www.blogger.com/profile/15784806194190213865noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3426153480142041318.post-38719868061728984432013-08-12T23:12:00.001-07:002013-08-12T23:12:59.595-07:00mysql not starting up after a change in configuration file<div dir="ltr" style="text-align: left;" trbidi="on">you have just made a change in the configuration file and trying to restart mysql but terminal is showing "failed to start". Now, if you will try to run the mysql console then it will show you the error regarding "can't find the socket" and this is obvious because the mysqld is not running in the back ground.<br /><br />To know what's happening with your mysql you can go to "<i>mysql-error.log"</i> that is residing mainly in the data-directory of your mysql-server.<br /><br />suppose you've encountered the error as follows:<br /><br /><i>InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes<br />InnoDB: than specified in the .cnf file 0 134217728 bytes!</i><br /><br />what it is trying to say is that "you have changed a new variable but the file corresponding to that variable in the data directory is not meeting to the specified requirement because it is somewhat smaller in size than that of the one defined in the configuration file".<br />now you've got the problem and thinking how to increase the size of that file that is in the data-directory then there is no need to do that because ib_logfile0 is the system generated file that would be generated automatically when you start the mysql. So, what you have to do is remove the file that is being generated previously and try to start the mysql.<br /><br /><span style="color: red;">WHAT!!</span><br /><span style="color: red;">still not starting!!!</span><br /><br />now you have to go to the mysql-error.log and i know what is creating the problem:<br /><br /><i>InnoDB: Error: log file ./ib_logfile1 is of different size 0 5242880 bytes<br />InnoDB: than specified in the .cnf file 0 134217728 bytes!</i><br /><br />this is the same file as that of the previous one and what you have to do is to delete it as you'd done before.<br /><br />now try to restart mysql it will work.<br /><br />now go to the data-directory and you will find the <i>ib_logfile0 </i>and <br /><i>ib_logfile1 </i>there.<i><br /></i></div>tushar_sharmaaahttp://www.blogger.com/profile/15784806194190213865noreply@blogger.com0tag:blogger.com,1999:blog-3426153480142041318.post-17200607632147558022013-08-12T22:34:00.000-07:002013-08-12T22:34:20.875-07:00mysql data-loss when re-installed<div dir="ltr" style="text-align: left;" trbidi="on">There is a possibility when you came to a situation when your MySql-server is showing you problem when you are trying&nbsp; to start it.<br />In the end what you have to do is to remove the mysql completely and re-install it.Yes! thats the easiest way to get back your mysql in a running state but what about your database that was there in the previous mysql "flushed out" you can't take a dump of your database because your mysql is not running so there is no way you can run mysqldump to take dump of your data.<br />to avoid this situation what you can do is:<br /><b>Daily dumping of data</b><br />you have to dump your data on daily basis so that in the end you'll have fully updated data. and you can say "yes i can install a new mysql server without any hitch". But what about last hour data, you cannot take dump of that data because your mysql-server just crashed today and you are only having data of the last night now this is going to be a headache.but there is another method to get rid of this situation<br /><b>copying the mysql data directory</b><br />now, you want to take the full backup of your updated data you dont need to take dump of your database daily nor you have to run a data-recovery software.you have to just copy the data that is in your mysq data-directory i.e /var/lib/mysql/"DATA" (here you will find various files like .frm,.ibd etc these are the files that keeps a record of metadata and other useful info of the tables) into a preferred location and then remove the previous mysql now before installing the new copy of the same you have to copy the same data into that mysql data-directory (make sure that you have not removed the data directory by <i><code>sudo rm -rf /var/lib/mysql</code></i>). now, install a fresh copy of mysql and run mtysql.&nbsp;run "show databases" and you'll get to know all the databases are there as if nothing happened to your old mysql-server.<br /><b>NOTE</b>:this information is only for the person who is using mysql for practice, on servers there are various backup tools running to take the complete and incremental backups.<br />-&gt;try to restart the mysql to your level best only after that follow this method.<br />go ahead give it a try</div>tushar_sharmaaahttp://www.blogger.com/profile/15784806194190213865noreply@blogger.com0