Mysql – importing data from .MYD back up file

MySQLsql

How I can load the data from myd back up file to the database table? I have all 3 files:
frm , myd and myi.

Best Answer

EXAMPLE the MyISAM table you are restoring is called mytable and datadir is /var/lib/mysql

SHOW DATABASES;

If one of the databases is named 'sample'

Step 1) Drop the mytable.frm, mytable.MYD, and mytable.MYI files /var/lib/mysql/sample

Step 2) cd /var/lib/mysql/sample

Step 3) chown mysql:mysql mytable.*

THAT's IT !!!

There is nothing to worry about in terms of mysql GRANTS. The information_schema will automatically record the presence of the new table in its tables. No need to restart mysql whatsoever.

In mysql client,

use sample
SHOW CREATE TABLE mytable\G
SELECT * FROM information_schema.tables WHERE table_schema='sample' AND table_name='mytable'\G
SELECT COUNT(1) FROM mytable;

Give it a Try !!!

Related Topic