mysqlfrm을 사용하여 frm 테이블 구조를 복원하는 방법

一个新手
풀어 주다: 2017-10-17 10:08:43
원래의
3530명이 탐색했습니다.

1. Mysqlfrm 설치

--------------------------------

mysqlfrm은 mysql의 일부이므로 -utilities 도구를 사용하면 mysql-utilities를 설치하고 해당 소스 코드 패키지를 다운로드하고 컴파일 및 설치할 수 있습니다.

shell> tar -xvzf mysql-utilities-1.6.4.tar.gz 
shell> cd mysql-utilities-1.6.4
shell> python ./setup.py build
shell> python ./setup.py install
로그인 후 복사

설치가 완료되면 해당 Python 실행 디렉터리에 mysqlfrm 및 기타 실행 파일을 보관할 수 있습니다.

2. mysqlfrm 관련 매개변수 소개

----------------------

--basedir :如 --basedir=/usr/local/percona-5.6.21
--server : 如 --server=user:password@192.168.1.100:3306
--diagnostic : 开启按字节模式来恢复frm结构
--user :启动MySQL用户,通过为mysql
로그인 후 복사

3. mysqlfrm 사용

------------

--basedir 모드를 사용하여 복원:

[ 16:35:29-root@br3cy1sw:~ ]# mysqlfrm --basedir=/usr/local/percona-5.6.21/ /root/t1.frm --port=3434 --user=mysql --diagnostic
# WARNING The --port option is not used in the --diagnostic mode.
# WARNING: The --user option is only used for the default mode.
# 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 /root/t1.frm:
# The .frm file is a TABLE.
# CREATE TABLE Statement:
CREATE TABLE `root`.`t1` (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`d` varchar(600) DEFAULT NULL,
PRIMARY KEY `PRIMARY` (`a`),
KEY `idx_t1_bc` (`b`,`c`)
) ENGINE=InnoDB;
    #...done.
로그인 후 복사

사용 --server 모드 복원 :

[ 16:35:10-root@br3cy1sw:~ ]#mysqlfrm --server=user:password@192.168.1.100:3306 /root/t1.frm --port=3434 --user=mysql --diagnostic
WARNING: Using a password on the command line interface can be insecure.
# WARNING The --port option is not used in the --diagnostic mode.
# WARNING: The --user option is only used for the default mode.
# Source on 192.168.1.100: ... connected.
# 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 /root/t1.frm:
# The .frm file is a TABLE.
# CREATE TABLE Statement:
CREATE TABLE `root`.`t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL,
`d` varchar(200) COLLATE `utf8_general_ci` DEFAULT NULL,
PRIMARY KEY `PRIMARY` (`a`),
KEY `idx_t1_bc` (`b`,`c`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    #...done.
로그인 후 복사

--basedir을 사용하여 복원된 varchar가 --server 모드의 3배라는 것을 알고 계셨습니까? 이는 basedir 모드를 사용할 때 mysqlfrm이 문자 인코딩 확인을 수행할 수 없기 때문에 발생하는 것입니다. .

--server 파일을 다시 살펴보세요: (빨간색과 굵은 텍스트에 초점을 맞추세요) 제안 사항: --server 모드를 사용할 수 있으면 mysqld 환경이 원본과 일치하는지 확인하면서 --server를 사용해 보세요. 생산 환경 .

--server=server
Connection information for a server. Use this option or --basedir for the default mode.
 
If provided with the diagnostic mode, the storage engine and character set information are validated against this server.
로그인 후 복사

위 내용은 mysqlfrm을 사용하여 frm 테이블 구조를 복원하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!