The mysqlfrm utility is designed as a recovery tool that reads .frm files and produces equivalent CREATE statements from the table definition data found in the file. In most cases, the generated CREATE statement is usable for recreating the table on another server, or for extended diagnostics. However, some features are not saved in the .frm files and therefore will be omitted. The exclusions include but are not limited to:
--basedir=BASEDIR the base directory for the server
--server=SERVER connection information for the server in the form: <user>[:<password>]@<host>[:<port>][:<socket>] or <login-path>[:<port>][:<socket>] (optional) - if provided, the storage engine and character set information will be validated against this server.
--diagnostic read the frm files byte-by-byte to form the CREATE statement. May require the --server or --basedir options to decipher character set information
--user=USER user account to launch spawned server. Required if running as root user. Used only in the default mode.
四、Mysqlfrm查看表结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[root@db01 ~]# mysqlfrm --diagnostic /data/mysql/data/gtid/t.frm # WARNING: Cannot generate character set or collation names without the --server option. # CAUTION: The diagnostic mode is a best-effort parse of the .frm file. As such, it may not identify all of the components of the table correctly. This is especially true for damaged files. It will also not read the default values for the columns and the resulting statement may not be syntactically correct. # Reading .frm file for /data/mysql/data/gtid/t.frm: # The .frm file is a TABLE. # CREATE TABLE Statement: