top of page

Quay Light Group

Public·6 members

How To Recover Table DDL From MySQL 8 Without FRM Files



How to Recover Table DDL from MySQL 8 without FRM Files




MySQL 8 introduced many changes and improvements to the database system, but also some challenges for data recovery. One of the most notable changes was the removal of the FRM files, which stored the table definitions and metadata. In MySQL 8, this information is stored in the data dictionary, a set of InnoDB tables that are hidden from the user.




How to Recover Table DDL from MySQL 8 without FRM Files



This means that if you need to recover a table DDL (data definition language) from a corrupted or inaccessible MySQL 8 instance, you cannot simply copy the FRM file from the data directory and use it with another server. You need to access the data dictionary and extract the table DDL from there. But how can you do that?


In this article, we will show you two methods to recover table DDL from MySQL 8 without FRM files: using the mysqlfrm utility and using the innodb-table-monitor plugin.


Using the mysqlfrm Utility




The mysqlfrm utility is a tool that can read and parse FRM files and generate the corresponding CREATE TABLE statements. It can also read the data dictionary from a MySQL 8 instance and generate the table DDL from there. To use it, you need to have access to the MySQL 8 data directory and run the utility with the --server option.


For example, if you want to recover the DDL for the table employees in the database test, you can run the following command:


mysqlfrm --server=root:password@localhost:3306 --port=3310 test.employees


This will start a new MySQL server instance on port 3310, read the data dictionary from the original instance on port 3306, and print out the CREATE TABLE statement for test.employees. You can then copy and paste the statement to another server or file.


Note that the mysqlfrm utility requires Python 2.7 or 3.x to run, and it may not work with some complex or encrypted table definitions.


Using the innodb-table-monitor Plugin




The innodb-table-monitor plugin is a plugin that can dump the InnoDB data dictionary to a file called innodb_table_monitor.out in the MySQL data directory. It can be useful for debugging and data recovery purposes. To use it, you need to have access to the MySQL 8 instance and install and enable the plugin.


For example, if you want to recover the DDL for all tables in the database test, you can run the following commands:


mysql> INSTALL PLUGIN innodb_table_monitor SONAME 'innodb_table_monitor.so';


mysql> SET GLOBAL innodb_table_monitor = ON;


This will trigger a dump of the InnoDB data dictionary to innodb_table_monitor.out. You can then open this file with a text editor and search for the table names and DDLs that you need. You can also use grep or other tools to filter out the relevant information.


Note that the innodb-table-monitor plugin may cause some performance overhead and lock contention on the server, so it is recommended to use it only when necessary and disable it after use.


Conclusion




In this article, we have shown you how to recover table DDL from MySQL 8 without FRM files, using two methods: the mysqlfrm utility and the innodb-table-monitor plugin. Both methods have their advantages and limitations, so you should choose the one that suits your situation best. We hope this article has been helpful for your data recovery needs. 04f6b60f66


About

Welcome to the group! You can connect with other members, ge...

bottom of page