Backing up your forum
A lot of web service providers say they do backup of all the files, but my opinion is not to take their word for granted. We have put in a lot of efforts and time in creating our forums,so if we lost them, then all our hard work would have been in vain. Backing up our forums at least once a week, makes sure that we never loose too much of our work in case of a server crash, and it will make us sleep better at night.
It is easy and fast, so there is no reason for not doing it.The way I see it we can make a backup in 4 different ways.
1.Through ''Forum Maintenance'' in the Admin Panel
When backing up this way it is better to do one backup with the ''the table structure'' option checked and another one without. So if later on,you will be restoring to a database in which the tables are already built, you can use the backup copy ''without the table structure'' and the other way around.
2.Through phpmyadmin at the Control Panel of your host
Open phpMyAdmin.
1. Click Export in the Menu to get to where you can backup you MySql database.
2. Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
3. Select"SQL"-> for output format, Check "Structure" and "Add AUTO_INCREMENT" value. Check "Enclose table and field name with backquotes". Check "DATA", check use "hexadecimal for binary field". Export type set to "INSERT".
4. Check "Save as file", do not change the file name, use compression if you want. Then click "GO" to download the backup file.
Note If you have large databases it may be not possible to backup using phpMyAdmin, as phpMyAdmin has some file size limits. So, in this case you will to use the command line tools that comes with Mysql. I came across this method recently and I am currently testing it. So, use it at your own risk
1. Change your directory to the directory you want to dump things to:
user@linux:~> cd files/blog
2. Use mysqldump (man mysqldump is available):
user@linux:~/files/blog> mysqldump --add-drop-table -h mysqlhostserver
-u mysqlusername -p databasename (tablename tablename tablename) | bzip2
-c > blog.bak.sql.bz2
Enter password: (enter your mysql password)
user@linux~/files/blog>
Example:
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp | bzip2 -c > blog.bak.sql.bz2
Enter password: my-password
user@linux~/files/blog>
The bzip2 -c after the pipe | means the backup is compressed on the fly.
Note: Compressing db's on the fly is only appropriate for small forums. -For large forums its best to compress after the dump due to it loading everything in memory when done on the fly.
Thanks to Tony for bringing this to my attention and reminding me to include it
3. The third method of making a backup is to use the create_backup.php tool created by Unknown, which you will find it attached at this post
Upload the create_backup.php tool to the same directory where your smf files are,point your browser to it and follow the instructions.
i.e. www.yoursite.com/forum/create_backup.php
Note that ''forum'' stands for the directory where your smf files are located. If your smf files are located to same other directory, then replace ''forum'' while pointing your browser with the name of that directory.
Or if your smf files are in the root directory, then point your browser to:
www.yoursite.com/create_backup.php
4. Using Java Backup Tool (Windows). I have never used this method, so I can not comment on its efficensy
Restoring the database
1. Through phpmyadmin at the Control Panel of your host
Open phpMyAdmin.
1. Click Import in the Menu.
2. Choose Location of the text file.
3.Browse to your backup of the database that you have stored in your computer
4. Choose Character and Format of imported file
5. Click Go
Restore without phpMyAdmin
The restore process consists of unarchiving your archived database dump, and importing it into your Mysql database.
Assuming your backup is a .bz2 file, creating using instructions similar to those given for Backing up your database using Mysql commands, the following steps will guide you through restoring your database :
1. Unzip your .bz2 file:
user@linux:~/files/blog> bzip2 -d blog.bak.sql.bz2
Note: If your database backup was a .tar.gz called blog.bak.sql.tar.gz file, then,
tar zxvf blog.bak.sql.tar.gz
is the command that should be used instead of the above.
2. Put the backed-up sql back into mysql:
user@linux:~/files/blog> mysql -h mysqlhostserver -u mysqlusername
-p databasename < blog.bak.sql
Enter password: (enter your mysql password)
user@linux~/files/blog:>
Now, as we mentioned above, phpMyAdmin has some file size limits so if you have large databases it may not be possible to backup using phpMyAdmin. In that case we can restore the backup in 2 other different ways, which are as follow:
1.Restore_backup.php tool created by Unknown, which can be found attached this post
Upload the restore_backup.php tool to the same directory where your smf files are,point your browser to it and follow the instructions.
i.e. www.yoursite.com/forum/restore_backup.php
Note that ''forum'' stands for the directory where your smf files are located. If your smf files are located to same other directory, then replace ''forum'' while pointing your browser with the name of that directory.
Or if your smf files are in the root directory, then point your browser to:
www.yoursite.com/restore_backup.php
2. The other way is through BigDump: Staggered MySQL Dump Importer
