6种innodb数据字典恢复方法
时间:2021-07-01 10:21:17
帮助过:30人阅读
>
USE sakila;
mysql>
CREATE TABLE actor (
->
actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
-> first_name VARCHAR(
45) NOT NULL,
-> last_name VARCHAR(
45) NOT NULL,
->
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
->
PRIMARY KEY (actor_id),
->
KEY idx_actor_last_name (last_name)
-> )ENGINE=InnoDB DEFAULT CHARSET=
utf8;
mysql>
ALTER TABLE sakila.actor DISCARD TABLESPACE;
shell>
cp /backup_directory/actor.ibd path/to/mysql-
5.7/data/sakila/
mysql>
ALTER TABLE sakila.actor IMPORT TABLESPACE; SHOW WARNINGS;
Query OK, 0 rows affected,
1 warning (
0.15 sec)
Warning |
1810 | InnoDB: IO Read error: (
2, No such
file or directory)
Error opening ‘./sakila/actor.cfg‘, will attempt to import
without schema verification
mysql> SELECT COUNT(*
) FROM sakila.actor;
+----------+
| count(*) |
+----------+
|
200 |
+----------+
6种innodb数据字典恢复方法
标签:first 表空间 key blog read backup imp sam timestamp