Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql database repair

Tags:

I had few problems with my server (hosting full, forgot mysql password etc.) Now that everything is fine when I check phpmyadmin I only have information_schema / mysql / performance_schema/phpmyadmin database available.

However I would like to get access to my database which is at /etc/mysql/mydb any idea how can I get access to it through phpmyadmin? mydb folder contains only .ibd + .frm files

like image 536
ChinaXiaoHong Avatar asked Jan 06 '18 15:01

ChinaXiaoHong


People also ask

What causes MySQL corruption?

Following are some of the common reasons behind MySQL corruption: Failure of server hardware. MySQL process gets killed in the middle of writing to the disk. Third-party software to access the database crashes unexpectedly.


1 Answers

In moving tables (or databases) from one machine, you must follow these rules. There may be exceptions where the migration will work, but it sounds like they don't apply to your situation.

  • Same version of MySQL/MariaDB (or "close enough")
  • If copying files, move the entire tree, not just one table or database.

The only safe way to migrate from one server to another is to dump and reload (mysqldump, XtraBackup, etc).

In particular, a simple InnoDB table involves 3 things (pre-8.0):

  • .ibd file containing the data and index(es). This exists only if the table was created when innodb_file_per_table=ON.
  • .frm schema.
  • Some other info in the communal ibdata1.

See also "transportable tablespaces". They may provide a way to copy part of a dataset from one machine to another.

like image 185
Rick James Avatar answered Sep 20 '22 13:09

Rick James