MYSQLFRM Preliminary use

Source: Internet
Author: User
Tags mysql version readable



This tool also reads the FRM file generation build statement
The default mode is to regenerate instances, use the--BASEDIR option or specify the--server option to connect to an already installed instance. This process does not change the original. frm file. This mode also needs to specify the--port option to use for the regenerated instance, which cannot conflict with an existing instance. After reading the. frm file, the regenerated instance will be closed and all temporary files will be deleted.
Diagnostic mode, you need to specify the--diagnostic option. Byte-by-byte read the. frm file to recover as much information as possible. This mode has more limitations, cannot verify the character set, cannot read the file using the default mode, or uses diagnostic mode if the MySQL instance is not installed on the server.
Installation
Need to install Mysql-connector-python first



wget https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.7-1.el6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/dev.mysql.com/pub/Downloads/MySQLGUITools/mysql-utilities-1.6.5-1.el6.noarch.rpm
wget ftp.pbone.net/mirror/dev.mysql.com/pub/downloads/mysqlguitools/mysql-utilities-extra-1.5.6-1.el6.noarch.rpm



Use the path you want to specify for the. frm file, or you can specify a directory in which all the. frm files will be read





Default mode
mysqlfrm --server = root: [email protected] --user = root --port = 3307 /data/mysql/ht/tb.frm
mysqlfrm --basedir = / usr --port = 3307--user = mysql /data/mysql/ht/tb.frm --show-stats




[[email protected] ~]# mysqlfrm --server=root:[email protected] --user=root --port=3307 /data/mysql/ht/tb.frm
WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... connected.
# Spawning server with --user=root.
# Starting the spawned server on port 3307 ... done.
# Reading .frm files
#
# Reading the tb.frm file.
#
# CREATE statement for /data/mysql/ht/tb.frm:
#

CREATE TABLE `ht`.`tb` (
  `id` int(11) NOT NULL,
  `name` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

#...done.
[[email protected] ~]# mysqlfrm --basedir=/usr  --port=3307 --user=mysql /data/mysql/ht/tb.frm  --show-stats
# Spawning server with --user=mysql.
# Starting the spawned server on port 3307 ... ERROR Attempting to stop failed spawned server.  Process id = 21404.
ERROR: Spawn server operation failed. Clone server error: Unable to communicate with new instance. Process id = 21404.. To diagnose, run the utility again and use the --verbose option to view the messages from the spawned server and correct any errors presented then run the utility again.
[[email protected] ~]# mysqlfrm --basedir=/usr  --port=3307 --user=root /data/mysql/ht/tb.frm  --show-stats
# Spawning server with --user=root.
# Starting the spawned server on port 3307 ... done.
# Reading .frm files
#
# Reading the tb.frm file.
#
# CREATE statement for /data/mysql/ht/tb.frm:
#

CREATE TABLE `ht`.`tb` (
  `id` int(11) NOT NULL,
  `name` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

# File Statistics:
#         Last Modified : Sat Jun 30 10:06:11 2018 #         Creation Time : Sat Jun 30 10:06:11 2018 #         Last Accessed : Sat Jun 30 10:06:11 2018 #                  Mode : 33184 #                  Size : 8586 # Table Statistics:
#                Engine : HEAP
#           frm Version : 10 #         MySQL Version : 5.7.22 #      frm File_Version : 5 #               IO_SIZE : 4096 #  Def Partition Engine : None

#...done.
View Code
Diagnostic mode
mysqlfrm --diagnostic /data/mysql/ht/tb.frm --show-stats




[[email protected] ~]# mysqlfrm --diagnostic /data/mysql/ht/tb.frm --show-stats
# 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/ht/tb.frm:
# The .frm file is a TABLE.
# CREATE TABLE Statement:

CREATE TABLE `ht`.`tb` (
  `id` int(11) NOT NULL, 
  `name` varchar(48) DEFAULT NULL, 
PRIMARY KEY `PRIMARY` (`id`)
) ENGINE=InnoDB;

# File Statistics:
#         Last Modified : Thu Jun 28 05:57:24 2018
#         Creation Time : Thu Jun 28 05:57:47 2018
#         Last Accessed : Fri Jun 29 23:01:23 2018
#                  Mode : 33184
#                  Size : 8586

# Table Statistics:
#                Engine : INNODB
#           frm Version : 10
#         MySQL Version : 5.7.22
#      frm File_Version : 5
#               IO_SIZE : 4096
#  Def Partition Engine : None

#...done.

View Code


Options
Some engine tables are not readable in the default mode. such as partition, Performance_schema, must be readable in diagnostic mode.
To change the storage engine in the CREATE statement, you can use the--new-storage-engine option. If you specify this option, you must also specify the--FRMDIR option, which generates a new. frm file with a prefix of New_ and is saved in the--frmdir directory.
Turn off all information in addition to the CREATE statement and warning or error messages, use the--quiet option.
Use the--show-stats option to count each. frm file information.
Use the--user option to specify which permissions the regenerated instance runs on.
If the regenerated instance starts more than 10 seconds, the--start-timeout option parameter needs to be adjusted.



MYSQLFRM Preliminary use


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.