Đọc tập tin frm mysql

tôi muốn đọc. frm và. ibd trong mysql để hiểu cách công cụ cơ sở dữ liệu mysql lưu trữ dữ liệu trong tệp. Các tệp đó có định dạng nào, vì khi tôi mở các tệp đó, nó hiển thị các ký tự không phải con người có thể đọc được

Do một vài lý do nào đó, hệ thống của bạn bị quá tải, hết tài nguyên v. v dẫn tới MySQL bị sập, cụ thể trong bài viết này là MySQL sử dụng Engine InnoDB mặc định bị sập, dẫn tới các tệp lưu tablespace của hệ thống InnoDB cùng với một số dữ liệu đang chờ xử lý trong cơ sở dữ liệu bị hỏng, bạn không thể

Thông báo lỗi thường gặp khi khởi động MySQL trong trường hợp trên

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.

[ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile '.\ibdata1' could not be found in the doublewrite buffer.

[ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption.

[ERROR] Plugin 'InnoDB' init function returned error. 

[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

[ERROR] Failed to initialize plugins. 

[ERROR] Aborting

 

//dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.0

//dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.1

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.2

  • Khi cài đặt xong câu lệnh mysqlfrm sẽ được thêm vào hệ thống

//dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.3

Use mysqlfrm

  • Tiến hành chmod -R 777 thư mục mysql đã sao lưu tại /tmp

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.4

  • Tiến hành sử dụng mysqlfrm trên dữ liệu của cơ sở dữ liệu DB1 đã được sao lưu trong thư mục /tmp. Ví dụ để trích xuất câu lệnh SQL dùng để tạo bảng Trình phát của cơ sở dữ liệu 1, ta sử dụng câu lệnh sau [viết 1 dòng]

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.5

//dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.6

//dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.7

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.8

[ERROR] InnoDB: Header page consists of zero bytes in datafile: .\ibdata1, Space ID:0, Flags: 0. Please refer to //dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.htmlfor how to resolve the issue.9

  • Quay lại mysql, tiến trình import back tablespace of table được tạo trong bước trước

[ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile '.\ibdata1' could not be found in the doublewrite buffer.0

  • Như vậy dữ liệu đã được phục hồi

  • Bạn tiếp tục thực hiện lại thao tác trên bảng khi hết bảng cần khôi phục

Như vậy sau bài viết này, bạn đã có thể thực hiện thao tác Khôi phục lại dữ liệu từ dababase MySQL sử dụng Engine InnoDB sau khi bị lỗi và làm hỏng các tệp chứa dữ liệu hoạt động của InnoDB

Chủ Đề