Tag: Mysql DB Backup and Restore
Mysql DB Backup and Restore How to
by sahab on May.31, 2010, under Backup, RHEL5, Ubuntu, ubuntu 10.04, ubuntu 7.10, ubuntu 8.04, ubuntu 8.10, ubuntu 9.04, Ubuntu 9.10
Database Backup
Eg:
Let’s assume that:
Username: ubuntu
Password: jaunty
Database Name: ubuntulinux
This will backup the database to a file called ubuntulinux.sql
Database Backup From the phpMyAdmin
1. Login to phpMyAdmin
2. Click on your database name
3. Click on the tab labeled EXPORT
4. Select all tables you want to backup (usually all)
5. Default settings usually work, just make sure SQL is checked
6. Check the SAVE FILE AS box
7. Hit GO
Restore Database From the Command Prompt
#mysql – u user_name -p your_password database_name < file_name.sql
Or using our previous example
If your database already exists and you are just restoring it, try this line instead:
#mysqlimport -u user_name -p your_password database_name file_name.sql
Or using our example again:
#mysqlimport -u ubuntu -p jaunty ubuntulinux ubuntuBackup.sql
Restore Database From the phpMyAdmin
- Login to phpMyAdmin
- Click on the tab labeled SQL
- Unclick the ‘show query here again’ box
- Choose your backup file
- Hit GO