How I can load the data from myd back up file to the database table? I have all 3 files:
frm
, myd
and myi
.
2 Answers
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 !!!
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.