Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18827

Create utility to parse frm files and print their DDL

    Details

      Description

      It would be useful if MariaDB had a utility that was able to parse frm files and print the DDL associated with the table.

      For example, it would be useful for users who performed a partial backup with Mariabackup:

      https://mariadb.com/kb/en/library/partial-backup-and-restore-with-mariabackup/

      But they forgot to also backup the table DDL, so they can't restore the tables using the following process:

      https://mariadb.com/kb/en/library/innodb-file-per-table-tablespaces/#importing-transportable-tablespaces-for-non-partitioned-tables

      mysqlfrm is a tool that already exists that does similar things:

      https://github.com/mysql/mysql-utilities/blob/master/scripts/mysqlfrm.py

      But it doesn't seem very user-friendly. It needs to be able to contact the local MariaDB server, and it also needs to be able to spawn a server instance, and it seems to need to be able to create a bunch of files during this process. e.g.:

      [ec2-user@ip-172-30-0-249 ~]$ cd /tmp
      [ec2-user@ip-172-30-0-249 tmp]$ sudo mysqlfrm --server=root:@localhost:3306 /var/lib/mysql/db1/tab.frm --port=12345 --user=mysql
      # Source on localhost: ... connected.
      # Spawning server with --user=mysql.
      # Starting the spawned server on port 12345 ... done.
      # Reading .frm files
      #
      # Reading the tab.frm file.
      #
      # CREATE statement for /var/lib/mysql/db1/tab.frm:
      #
       
      CREATE TABLE `db1`.`tab` (
        `id` int(11) NOT NULL,
        `str` varchar(50) DEFAULT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
       
      #...done.
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                GeoffMontee Geoff Montee
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: