Tutorials
Backup your database
-
Backup your database
Posted on July 1, 2003
Written by
Sasha (view more by Sasha)
Comments (0)
Filed under MySQL, Tutorials
Making backups is always a good thing. Servers can crash, databases can get lost, and if your host doesn’t have a current backup, you could lose all your tables.
I recommend making backups at least once a week. More often if you use MySQL a lot and your tables are updated every day.
It’s very easy and quick to do, so you have no good reason to not do it.
The following tutorial will show you step by step how to make a backup using phpMyAdmin (available on most servers).
Login to phpMyAdmin, your database should be in the frame on the left, with all the tables in it listed below that. Click on your database name.
You should now get a list of all tables in the main window, along with how many records are in each.
There should be a number of tabs at the top, saying "Structure, SQL, Export, Search, Query".
Click on the tab that says Export. You will get a page where you can choose several export. This screen looks a little different in each version of phpMyAdmin, but basically, you have to make sure Structure and Data are ticked. If there’s a dropdown box with all your tables, make sure you click the Select All link to get them all selected (unless there are some tables you don’t want to back up, of course).
Don’t tick any of the other options, except for the last one, which will be something like "Save As File", with some choices below it. If it’s there,
tick the "zipped" choice as well. Then click the submit button.
If you ticked "Save As File", you will now get a normal download window, asking you where you want to save the file.
If you didn’t tick it, you will get a page that displays all your database information in text format. Just select all of it by clicking Ctrl-a and copy it. Open up Notepad, paste it all into a new document, and save it.
How to restore downloaded backups
Note: You will need to have created the database before being able to restore the information.
Go into your phpMyAdmin for the database where you want to import the tables you just exported.
Again, click on the database name, and then the SQL tab. You will now get a window with a text area and a form field with a browse button.
Ignore the text area, and click on the browse button. Locate your file. If the file is a zip file, choose "zipped" under "compression", if you have that option. Click the submit button, and that’s it. Your tables will then be imported.
Comments
Comments are closed for this entry.