문제 1 : MySQL과 WordPress으로 운영되는 블로그에서 백업이 안 된다.
조치 1 : phpMyAdmin에서 복구 명령을 실행시켰다.
문제 2 : phpMyAdmin에서 테이블에 “사용중”이란 메시지만 나타났다. 또한, “복구”명령에서 에러가 떴다.
조치 2 : MySQL을 멈추기 위해서 다음과 같이 명령을 입력했다.
[shell]~$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [fail][/shell]
문제 3 : mysqld를 멈출 수 없다.
조치 3 : 다음 명령어를 입력했으나, 멈추지 않았다.
[shell]mysqladmin -u root -p shutdown[/shell]
문제 4 : mysqld를 멈출 수 없다.
조치 4 : 명령어를 다음과 같이 입력했다. 드디어 멈췄다.(ubuntu 14.04)
[shell]$ sudo service mysql stop
mysql stop/waiting[/shell]
문제 5 : myisamchk를 이용하여 복구하려 했으나 다음과 같은 메시지가 떴다.
[shell]$ sudo myisamchk *.MYI
Checking MyISAM file: wp_commentmeta.MYI
Data records: 4 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed and last repair failed
– check file-size
– check record delete-chain
– check key delete-chain
– check index reference
– check data record references index: 1
– check data record references index: 2
– check data record references index: 3
– check record links
MyISAM-table ‘wp_commentmeta.MYI’ is usable but should be fixed[/shell]
조치 5 : myisamchk를 통해 복구를 시도했다.
[shell]$ sudo myisamchk -r wp_commentmeta.MYI
– recovering (with sort) MyISAM-table ‘wp_commentmeta.MYI’
Data records: 4
myisamchk: error: Can’t create new tempfile: ‘wp_commentmeta.TMD’
MyISAM-table ‘wp_commentmeta.MYI’ is not fixed because of errors
Try fixing it by using the –safe-recover (-o), the –force (-f) option or by not using the –quick (-q) flag
[/shell]
문제 6 : 에러 메시지 “error: Can’t create new tempfile”가 나타나고 복구가 되지 않았다.
조치 6 : 강제 복구 명령어를 입력했다.
[shell]$ sudo myisamchk -f wp_commentmeta.MYI
Checking MyISAM file: wp_commentmeta.MYI
Data records: 4 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed and last repair failed
– check file-size
– check record delete-chain
– check key delete-chain
– check index reference
– check data record references index: 1
– check data record references index: 2
– check data record references index: 3
– check record links
– recovering (with sort) MyISAM-table ‘wp_commentmeta.MYI’
Data records: 4
– Fixing index 1
– Fixing index 2
– Fixing index 3[/shell]
조치 7 : 드디어 모든 테이블을 복구했다. 그래서 mysql을 재실행하다.
[shell]$ sudo service mysql start[/shell]
<교훈(lessons)>
1. ubuntu 14.04에서 MySQL를 멈추거나 실행하기 위해서는 다음과 같은 명령어를 입력한다.
[shell]$ sudo service mysql stop
$ sudo service mysql start[/shell]
2. 테이블를 복구하기 위해서는 myisamchk명령어를 이용한다.
[shell]$ sudo myisamchk -r wp_commentmeta.MYI
$ sudo myisamchk -f wp_commentmeta.MYI[/shell]