[mysql 5] How could I move a table from one database to another?
am 08.03.2007 09:51:22 von toylet
I have a *damaged* MyISAM stock_take_mst.frm in /var/lib/mysql/abc.
And I would like to move it to /var/lib/mysql/test and experiment with it.
Is there a MySQL command to detach and attach a table?
--
iTech Consulting Co., Ltd.
Expert of ePOS solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
Re: [mysql 5] How could I move a table from one database to another?
am 09.03.2007 03:09:08 von gordonb.ftdft
>I have a *damaged* MyISAM stock_take_mst.frm in /var/lib/mysql/abc.
>And I would like to move it to /var/lib/mysql/test and experiment with it.
>
>Is there a MySQL command to detach and attach a table?
No, but you can do this (for MyISAM tables):
1. Shut down the MySQL server.
2. Move the file to its location. You probably want to take
stock_take_mst.MYI and stock_take_mst.MYD along with
stock_take_mst.frm . Make sure the permissions are correct.
(Probably owner mysql:mysql and mode 660 for files and 770 for
directories).
3. Restart the MySQL server.
You may be able to replace steps 1 and 3 with a "flush tables" command if
you can keep other clients off the new or old table name.