Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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 !!!

share|improve this answer
add comment

In most cases, you just can copy the files into your MySQL datadir and (re)start mysql - the database will be available for local use as "root".

As access permissions are not stored in the database itself, but in a table of the "mysql" database, you might need to add permissions for access by remote or non-root users using the GRANT syntax.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.