Database - Restore
[[::Database - Restore|English]]
[[::Database - Restore|English]]
|This page provides some of the considerations for restoring TNG and different methods for doing the Database Restore. See Database - Backup for the database backup methods.||
TNG Maintenance – backup and restore
It takes a lot of work and effort to collect family information. Being able to store it in an application like TNG makes it easy to view, share and expand. And the prudent researcher keeps a second copy of all the data as insurance, just in case the first copy gets lost or damaged.
TNG is designed for use with a web server, whether it is on a distant host or one you have at home. This makes taking a copy just a little more complicated, but quite within the ability of anyone here. Doing the reverse, restoring your work, is not very difficult, either.
For our purposes, there are 2 parts to TNG.
- The first part is the scripts – TNG itself, the application. This is the part you buy and load to your server.
- The second part is the SQL database, which is created and filled (“populated”) with your data. This is the truly valuable part of your work.
Some of the work involved in backing up requires use of FTP (File Transfer Protocol), a means of moving files to and from a server. If you are not familiar with the process, there are instructions for the most used, FileZilla, at http://wiki.filezilla-project.org/Using or for WinSCP at http://winscp.net/eng/docs/guides
Depending on your host, you will have other tools available to you. The most common are phpMyAdmin (which provides direct access to the SQL database), and cPanel (a rollup of useful tools, including phpMyAdmin.)
This document will assist you to restore your backup files.
There is a technique of backing up and restoring to and from a different environment – say, a backup from online to an offline copy of TNG. This backup can also be restored. The topic is reported at http://tng.lythgoes.net/wiki/index.php?title=MoWeS
Restoring is sometimes more complicated than backing up, especially if the condition of the web server is not known. Experienced users could examine the server-side scripts and databases, and only repair the broken bits. But this can be very time consuming, so it might be quicker and more positive to rebuild TNG from scratch. and import only the data. Your mileage may vary...
Let’s begin by checking out the database situation on the server.
Method 1 – Using phpMyAdmin
|Start phpMyAdmin. You will have been given your username and password by your system administrator (or you have chosen your own, if you are running on a home sever.)|
|Have a look in the database panel, checking to see whether your previous database is listed there. If not, skip to the next step. But if it is, the best thing to do is to wipe it out before beginning again.|
At the top of this screen, locate the SQL tab and click it. This opens a box for you to type in. Assuming your previous database was yourname_05, type drop database yourname_05 in the box. Double check your typing - this is a major command. If it is OK, click the Go button. You will be asked to confirm your action, so go ahead if you are confident.
Starting with a clean slate, you can now create your old database again, with the same or a different name. See the note below about the implications of choosing a different name.
Select your new database in the leftmost column, then click Import on the top tab. Browse to your xxxxx.sql file. In the lower panel, select ‘SQL’. Find the Go button and click it. The system will locate your backup file, recreate all the tables, and reload ('populate') them with your previous data.
Method 2 – Using cPanel
|The cPanel provides you with a backup Wizard in the Files section. Click on Backup Wizard.|
|Step 1: Click on Restore -->|
|Step 2:Time to decide what you want – in fact, it will be a reflection of what you chose during backup.|
When you have done this, you will be asked to name and upload the backup file. After that, cPanel gets busy…..and that's all you need to do. If you backed up your TNG scripts, repeat this step, this time choosing to restore your Home Directory.
Method 3 – Using TNG’s internal system
Method 3a - Using TNG backups in phpMyAdmin
Note that if your TNG database contains large tables, they may not restore using the TNG Utilities. Since the TNG table backups are comma separated values, they can be imported using phpMyAdmin, the table size is less than the phpMyAdmin import 20MB limit.
The sequence of steps for emptying the table depends on the phpMyAdmin version being used:
Import TNG Backup File
The screen layouts are slightly different depending on the phpMyAdmin version, but the sequence of steps for importing a TNG backup (.bak) are the same provided the file size is less than the phpMyAdmin 20 MB import limit. Image shown is that of phpMyAdmin 3.5.
If any of your TNG tables are larger than 20MB, you should be using a different backup / restore method.
Method 4 – Using MySQLDumper
You may use this utility to rebuild (or transfer) data tables. Instructions are provided with the utility.
About using a different filename
TNG keeps a database connection record in the file config.php
If you decide to use a different filename on the same server, you will need to amend this file. You can do this with your FTP client, eg., FileZilla_-_FTP_Client or at Using FileZilla or for WinSCP at WinSCP Guide.
The first few lines of config.php look a bit like this:
$database_host = "localhost.somewhere.net";
$database_name = "yourname_05";
$database_username = "billybunter";
$database_password = "shazam222";
$tngconfig['maint'] = "";
You will need to amend the third line to reflect the new name you have chosen. Remember to use quotes, and leave the semi-colon (;) on the end of the line.