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
January 12th, 2012 on 11:18 am
In the last recipe to ‘Restore Database From the phpMyAdmin’ don’t you have to choose an ‘import’ option somewhere in the phpMyAdmin GUI??
January 12th, 2012 on 11:20 am
Thanks heaps for publishing this article. It will really help me in the future. Help like this is one of the Great Things about using Ubuntu.
April 19th, 2012 on 10:55 am
What a great list. How did you get that on your blog?
April 20th, 2012 on 2:33 am
thanks man, this was very helpful