Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What happens if I delete the ibdata1 file and restart the server, my database is MyISAM, I used InnoDB before but now all tables are MyISAM. Will be a big problem if I delete this file. As far as I know that will be recreated when I restart the server, but I don't understand what exactly is that file!

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

You should do the following:

Add this to /etc/my.cnf

[mysqld]
skip-innodb

Then perform the following:

  1. service mysql stop
  2. rm -f /var/lib/mysql/ib*
  3. service mysql start

As to what the file is : ibdata1 stores the internal metadata for each InnoDB table that exists. Make sure all InnoDB tables are converted to MyISAM or mysqldump'd out before deleting ibdata1. There are also two other files: ib_logfile0 and ib_logfile1. Those are InnoDB log files for holding running transactions not fully commited to disk as well as MVCC (Multiversioning Concurrency Control) data.

Once you restart mysql from those three(3) steps, none of the InnoDB files should reappear. In fact, you should get a much faster mysql startup.

Don't forget to scale up the key_buffer_size

share|improve this answer
add comment

InnoDB stores the tablespace for all tables with ENGINE=InnoDB in that file whereas in MyISAM the tablespace is stored in individual .MYD and .MYI files.

Cheers

share|improve this answer
    
InnoDB can also stores tables in .idb files. –  Kedare Jun 8 '11 at 17:48
    
@Kedare, True if using innodb_file_per_table, but that is not the default configuration. –  HTTP500 Jun 15 '11 at 14:55
add comment

Yes, you can remove the ibdata1 file. However, as long as you have the InnoDB engine enabled, the file will be recreated at startup. I wouldn't delete this file while the mysqld service is running.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.