Ways to Recover Inaccessible Data from MySQL ibdata1 Files

Megha Chouhan
Megha Chouhan | Published On - 16 Feb 2022 |

Read time: 3 minutes

Today I am here to discuss how to recover data from ibdata1 as we have received many queries on this issue. Before proceeding towards the issue, let’s discuss how it happens?

What is MySql?

MySql is a big data ecosystem and also is the most popular database which is effective regardless of industry. When it comes to brilliant interface and syntax, MySql is named globally among other query languages and database. Using MySql, one can immediately build fast, powerful, and secure data storage systems. MySql is widely used due to its speed, reliability, ease of use, and wide compatibility.

What is happening in MySQL InnoDB?

We all know very well that InnoDB has made advancements in every aspect, but the problem is why InnoDB stores all databases in one file i.e. ibdata1 by default. The answer is it maps the location of the data in the file by individual index files for tables. But why does it mix all data in one file? And more importantly, why does it mix the data of all databases on the server?

Ibdata1 is the system tablespace used for InnoDB where all data are stored in the form of table with Table data pages and table index pages. InnoDB table data might be missing due to the following reasons;

  • Accidental deletion of data
  • MySql server instance crashed
  • MySql database table is corrupted, causing the data to be unreadable

How to Recover Data from Ibdata1 file?

Data recovery from MySQL is not that easy, especially if you are looking for a manual method. However, the availability of professional MySQL recovery tools has simplified the ibdata1 file recovery considerably. Here, we will discuss both methods.

Solution1- Manual Method for MySQL Recovery

  1. Open MySql configurations file (my.cnf).
  2. Set ‘innodb_log_file_size’ value equal to the size of the ib_logfile0 file in my.cnf file.
  3. You can calculate InnoDB log file size by running ls -lh ib_logfile0 command.
    E.g.- If the size of the ib_logfile0 file is 128M, then you should set the innodb_log_file_size value to 128M:

  4. Copy the ibdata files to the MySQL data directory. Using cp –r /new/ibdata* /var/lib/mysql/
  5. Create an empty folder inside the new MySQL datadir. This folder must have the same database schema name as the one that needs to be restored.
  6. Copy the .frm files inside that folder by executing these commands:
  7. cp –r /new/ib_logfile* /var/lib/mysql/
    cp –r /new/schema_name/*.frm /var/lib/mysql/schema_name/
  8. Start your MySQL server again using service mysqld restart
  9. Now you can see that all the tables and their data are restored.
    Note: Always make sure to back up all of the MySQL files and database. After backing up everything, you can start troubleshooting.

Solution 2- Professional Method Using Kernel for MySQL Database Recovery

When you find that the data is still missing in the restored MySQL tables, then try to understand this manual method is not for your solution. You must switch to a professional automation solution by using a professional tool like Kernel for MySQL Database Recovery which simply recover deleted records in SQL server. This tool will repair your corrupt all kinds of MySQL databases that have come to halt, due to corruption problems in ibdata1 files, from reasons like hard drive failure, media contamination, virus intrusion, etc.


The tool is programmed with advanced algorithms which have the capability to detect and select the MySQL database version. Here you can retrieve the corrupt as well as deleted records. The user can select any table to view its components further and verify the data authenticity before saving.


MySQL has its own place as a popular database management system. When there is a MySQL data loss situation, we can consider options like restoring data by manual methods or by using professional tools. But I always suggest going for a professional tool that works great without any difficulties like repair corrupt SQL database. You can opt for our best Kernel for MySQL Database Recovery tool which will recovers tables, and other objects preserving the original data structure and properties.