This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:server:db_restore [2008/10/26 04:40] jonyo |
tutorials:server:db_restore [2014/09/25 16:55] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Restore your Database ====== | ====== Restore your Database ====== | ||
- | |||
- | TODO: Finish this page. (cleanup, images, etc.) | ||
In the previous Tutorial we covered how to perform a Database Backup. In this Tutorial we will discuss how to restore the database if you need to. Some reasons for restoring a database would be: | In the previous Tutorial we covered how to perform a Database Backup. In this Tutorial we will discuss how to restore the database if you need to. Some reasons for restoring a database would be: | ||
- | + | * database became corrupt | |
- | • database became corrupt | + | |
- | • database inadvertently deleted | + | |
- | • copying a database from one installation to another | + | |
- | + | ||
- | + | ||
Regardless of the situation, the process is always the same. Keep in mind, however, that when you restore a database you are effectively overwriting the existing database. Therefore, any changes to settings and templates, registrations that took place, listings that were entered, etc. between the time you performed your the back up until now will be lost. With that understanding, | Regardless of the situation, the process is always the same. Keep in mind, however, that when you restore a database you are effectively overwriting the existing database. Therefore, any changes to settings and templates, registrations that took place, listings that were entered, etc. between the time you performed your the back up until now will be lost. With that understanding, | ||
- | + | - Before going any further you need to first prepare your backup file for importing. What this means is that you need to open up that .sql file and break it apart into smaller files. Why? Because the one single .sql file that you have now is more than likely too large for the server to handle all at one time. In other words, PHP on your server would "time out" before it finished running the entire file, leaving you with only a partially restored database. You can overcome this server limitation by breaking up the single file into several smaller files. | |
- | + | ||
- | Step 1: | + | |
- | + | ||
- | Before going any further you need to first prepare your backup file for importing. What this means is that you need to open up that .sql file and break it apart into smaller files. Why? Because the one single .sql file that you have now is more than likely too large for the server to handle all at one time. In other words, PHP on your server would "time out" before it finished running the entire file, leaving you with only a partially restored database. You can overcome this server limitation by breaking up the single file into several smaller files. | + | |
- | + | ||
- | + | ||
Ideally, you need to break the sql into 5 or 6 separate files. Simply open your .sql file and cut/paste a portion of the code into a new file. Save it and then repeat the process until you have created 5 or 6 separate files from the original .sql file. Your new files can be saved as any name you like. However, we recommend naming them by number so that you can maintain the order in which you upload them in a later step. ORDER IS IMPORTANT. | Ideally, you need to break the sql into 5 or 6 separate files. Simply open your .sql file and cut/paste a portion of the code into a new file. Save it and then repeat the process until you have created 5 or 6 separate files from the original .sql file. Your new files can be saved as any name you like. However, we recommend naming them by number so that you can maintain the order in which you upload them in a later step. ORDER IS IMPORTANT. | ||
- | |||
- | |||
As long as you keep the files in order as described above, you don't have to worry about splitting up a large sql table between two files. If PHP finishes running a partial table in one file, it will then pick right back up and finish that table in the next file, if you upload them in the proper order. | As long as you keep the files in order as described above, you don't have to worry about splitting up a large sql table between two files. If PHP finishes running a partial table in one file, it will then pick right back up and finish that table in the next file, if you upload them in the proper order. | ||
- | + | <tip c w> | |
- | + | ||
- | important IMPORTANT: Ensure that your .sql file contains DROP TABLES for each table within the code. Failure to do so will result in error messages being displayed in phpMyAdmin. If you followed the steps in the " | + | |
- | + | ||
- | + | ||
- | + | ||
- | droptable | + | |
- | + | ||
- | + | ||
- | + | ||
- | Step 2: | + | |
- | + | ||
- | Log in to phpMyAdmin. | + | |
- | + | ||
- | + | ||
- | + | ||
- | note NOTE: The page layout and required steps may vary slightly depending upon the version of phpMyAdmin that is installed on your domain. | + | |
- | + | ||
- | + | ||
- | + | ||
- | Step 3: | + | |
- | + | ||
- | Select the database name you want to restore from the dropdown. | + | |
- | + | ||
- | + | ||
- | + | ||
- | myadmin_7 | + | |
- | + | ||
- | + | ||
- | + | ||
- | Step 4: | + | |
- | + | ||
- | When the screen refreshes you will see a list of tables that are currently present within the database you just selected. The same set of table names will display on both sides of the screen. (If this is a new database, or if you have previously ' | + | |
- | + | {{ : | |
+ | < | ||
+ | - Log in to phpMyAdmin. | ||
- | note NOTE: Older versions | + | <tip c n>**Note:** The page layout and required steps may vary slightly depending upon the version |
+ | < | ||
+ | - Select the database name you want to restore from the dropdown. | ||
- | + | {{ : | |
+ | < | ||
+ | - When the screen refreshes you will see a list of tables that are currently present within the database you just selected. The same set of table names will display on both sides of the screen. (If this is a new database, or if you have previously ' | ||
- | myadmin_8 | + | <tip c n> |
- | + | {{ : | |
+ | < | ||
+ | - You should now see a screen that looks similar to the image below. Click on the " | ||
- | Steps 5 & 6: | + | {{ :tutorials: |
+ | < | ||
+ | - You should now be able to log in to the software' | ||
- | You should now see a screen | + | <tip c w> |
+ | < | ||
- | + | ===== Working Through Problems When Running Queries ===== | |
- | myadmin_9 | + | We have had a bit of experience importing databases and can provide a few pointers. |
- | + | Break your export into several "bite size" pieces so that each file doesn' | |
- | Step 7: | + | The geodesic_classifieds table is the the hardest to import. |
- | You should now be able to log in to the software' | + | You can remove this query from this import file and place it within a specific place to be run later individually. |
- | + | You can also choose to deal with the query error at this point before going further into the import. | |
- | important IMPORTANT: Ensure that your .sql file contains DROP TABLES for each table within the code. Failure to do so will result in error messages being displayed in phpMyAdmin. | + | If you stopped |
+ | You may not decide to run the query at all. You have to do a little investigation and possibly a question or two to support. | ||