Archive for April 26, 2007

A little thing called ibdata

One day my VM ran out of memory! I know I’m a number cruncher and that takes up lots of space but come on! Got to the bottom of this with a little du -sk and found that a stupid file called ibdata hogging up all the space. I did it the WRONG way by just deleting the culprit right then and there, but here’s the way you SHOULD do it:

1. dump dbs
2. shutdown mysql with sudo service mysqld stop
3. delete the /var/lib/mysql/ ibdata file
(if you don’t do this next step you can’t get the mysqld back up!)
4.delete the ib_logfile1 ib_logfile0 files
5. go thru each database directory in /var/lib/mysql and delete any .frm and .ibd files
* you can use sudo -s to get into shell mode since sudo cd table_name/ may not work
if you don’t do this step you’ll get http://bugs.mysql.com/bug.php?id=15319 the ERROR 1051 (42S02): Unknown table ‘t1′ error where the data will be gone (from ibdata1) but the schema will still be there (.frm and .ibd files)
6.turn on mysqld start
7. reload dbs

/etc/my.conf has all the table settings including the one that will put one innodb database PER FILE instead of everything in one file.

go to /var/log/ mysqld.log to check for mysql error msgs – checking is goood….

Comments (1)