How to restore MySQL databases on Linux

Once the files have been restored to a location such as /tmp, import the files via the command line utility mysql or via a utility such as phpMyAdmin.

The databases are exported from via sqldump when they are backed up, this means that they can be directly imported into existing tables.

For example:

A database called lushsoft is backed up as part of the backup set MySQLBackups.  The Restore.sh is modified for the backup set MySQLBackups and restores to /tmp.

Using the mysql command in the tmp directory we run:

root> mysql -u root -p -t lushsoft < lushsoft.sql

When the database is backed up the file is called <database name>.sql therefore the database and filename are always the same.

You can also restore the backup using the web front end to a client machine and then import using phpmyadmin.

Article ID: 41, Created On: 8/26/2009, Modified: 8/26/2009

Comments (0)