MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Ca'Grande, Milan, Italy)

RESTORE TABLE Statement

This MySQL statement restores a table that was saved to the filesystem by the BACKUP TABLE statement, which is deprecated.

hits past month: 23 ;  last updated: may 4, 2009 - 2:34am ;  parent: MySQL Table & Server Administration Statements

Syntax

RESTORE TABLE table[,  . . . ] FROM '/path'

Explanation

This MySQL statement restores a MySQL table that was saved to the filesystem by the MySQL statement, BACKUP TABLE. Multiple MySQL tables may be given in a comma-separated list. The absolute path to the directory containing the backup files must appear within quotes. If the tables already exist in the database, an error message will be generated and the restore will fail. If it's successful, the table indexes will be built automatically. This is necessary because the MySQL statement, BACKUP TABLE doesn't back up the index files.

Examples

Below is an example of this MySQL statement:

RESTORE TABLE clients, programmers FROM '/tmp/backup';

+--------------------------+---------+----------+----------+
| Table                    | Op      | Msg_type | Msg_text |
+--------------------------+---------+----------+----------+
| workrequests.clients     | restore | status   | OK       |
+--------------------------+---------+----------+----------+
| workrequests.programmers | restore | status   | OK       |
+--------------------------+---------+----------+----------+

In this example, the statement was successful in restoring the .frm and .MYD files located in the backup directory and regenerating the .MYI files.

Return to MySQL Table & Server Administration Statements page of our MySQL Documentation