ラック
Home > CMS > 記事 > 2017年12月 > WordPressのデータベース復旧

WordPressのデータベース復旧

カテゴリ: WordPress

httpdでOut Of Memory Errorが出てしまい、復旧させた後。/var/log/httpd/error-logに何かよろしくないエラーが……。


[Mon Dec 04 10:43:31 2017] [error] [client XXX.XXX.XXX.XXX] WordPress \xe3\x83\x87\xe3\x83\xbc\xe3\x82\xbf\xe3\x83\x99\xe3\x83\xbc\xe3\x82\xb9\xe3\x82\xa8\xe3\x83\xa9\xe3\x83\xbc: Table 'wp_options' is marked as crashed and should be repaired for query SELECT option_value FROM wp_options WHERE option_name = 'uninstall_plugins' LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), call_user_func_array, cptp_init_instance, CPTP::get_instance, CPTP->__construct, CPTP->init, do_action('CPTP_init'), call_user_func_array, CPTP_Module_Option->add_hook, register_uninstall_hook, get_option

## 略

これは……DBのテーブルが壊れたっぽいですね。


# mysql -u root -p
mysql> use wordpressdb;

WordPressのテーブルを選択して、チェック。


mysql> check table wp_options;
+------------------------+-------+----------+-------------------------------------------------------+
| Table                  | Op    | Msg_type | Msg_text                                              |
+------------------------+-------+----------+-------------------------------------------------------+
| wordpressdb.wp_options | check | warning  | Table is marked as crashed                            |
| wordpressdb.wp_options | check | warning  | 1 client is using or hasn't closed the table properly |
| wordpressdb.wp_options | check | error    | Wrong record length 324 of 328 at 3436                |
| wordpressdb.wp_options | check | error    | Corrupt                                               |
+------------------------+-------+----------+-------------------------------------------------------+
4 rows in set (0.00 sec)

壊れてますね。ちなみに、壊れていないテーブルであれば


mysql> check table wp_postmeta;
+-------------------------+-------+----------+----------+
| Table                   | Op    | Msg_type | Msg_text |
+-------------------------+-------+----------+----------+
| wordpressdb.wp_postmeta | check | status   | OK       |
+-------------------------+-------+----------+----------+
1 row in set (0.00 sec)

こんな感じで出ます。

さて、対処法を調べて早速対処です。


mysql> repair table wp_options;
+------------------------+--------+----------+------------------------------------------------------+
| Table                  | Op     | Msg_type | Msg_text                                             |
+------------------------+--------+----------+------------------------------------------------------+
| wordpressdb.wp_options | repair | info     | Wrong block with wrong total length starting at 3436 |
| wordpressdb.wp_options | repair | warning  | Number of rows changed from 259 to 258               |
| wordpressdb.wp_options | repair | status   | OK                                                   |
+------------------------+--------+----------+------------------------------------------------------+
3 rows in set (0.03 sec)

mysql> check table wp_options;
+------------------------+-------+----------+----------+
| Table                  | Op    | Msg_type | Msg_text |
+------------------------+-------+----------+----------+
| wordpressdb.wp_options | check | status   | OK       |
+------------------------+-------+----------+----------+
1 row in set (0.00 sec)

直りました。これでOKですね。

参考

タグ: トラブル対処

 



関連する記事一覧