MySQL 8.0 使用ibd文件恢复数据步骤

#第一步创建这张表
CREATE TABLE `admin_channels` (
`admin_channel_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT ‘id‘,
`admin_channel_user_id` INT(11) NOT NULL DEFAULT ‘0‘ COMMENT ‘userid‘,
`admin_channel_code` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ‘‘ COMMENT ‘角色channel code‘,
`admin_channel_status` TINYINT(1) NOT NULL DEFAULT ‘0‘ COMMENT ‘状态 0-正常 1-停用‘,
`admin_channel_create_at` DATETIME NOT NULL DEFAULT ‘1000-01-01 00:00:00‘ COMMENT ‘创建时间‘,
`admin_channel_update_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘更新时间‘,
PRIMARY KEY (`admin_channel_id`),
UNIQUE KEY `admin_channel_user_id` (`admin_channel_user_id`)
) ENGINE=INNODB ROW_FORMAT=DYNAMIC;

#第二步执行该命令
ALTER TABLE admin_channels DISCARD TABLESPACE;

#第三步 复制admin_channels.ibd到本地文件下,我的是C:\phpstudy\Extensions\MySQL8.0.12\data\test_db

#第四步执行该命令
ALTER TABLE `admin_channels` IMPORT TABLESPACE;

#第五步查看信息
SHOW WARNINGS;

Enjoy it !

MySQL 8.0 使用ibd文件恢复数据步骤

上一篇:oracle删除表中某些字段重复的数据


下一篇:MySQL按字符串中部分数值排序