Holly Nicole
New member
- Joined
- Feb 22, 2013
- Messages
- 302
- Points
- 0
[h=2]Backup using cPanel X[/h] cPanel is a popular control panel used by many web host. The backup feature can be used to backup your MySql database. Do not generate a full backup, as these are strictly for archival purposes and cannot be restored via cPanel. Look for 'Download a MySQL Database Backup' and click the name of the database. A *.gz file will be downloaded to your local drive.
There is no need to unzip this file to restore it. Using the same cPanel program, browse to the gz file and upload it. Once the upload is complete, the bottom of the browser will indicate dump complete. If you are uploading to a new host, you will need to recreate the database user along with the matching password. If you change the password, make the corresponding change in the wp-config.php file.
[h=2]Using phpMyAdmin[/h] phpMyAdmin is the name of the program used to manipulate your database.
Information below has been tried and tested using phpMyAdmin versions 2.5.3, 2.5.7-pl1, and 2.6.1-pl3 running on Unix.
Detailed options are listed below, though in most cases you will be fine with the default export options.
[h=3]Backup Process with phpMyAdmin[/h]
1. Change your directory to the directory you want to dump things to:
user@linux:~> cd files/blog 2. Use mysqldump to dump all database tables. To dump only certain tables from the database, give their names at the place shown by (tablename tablename tablename), and omit the parentheses ( ) in any case. (For help, try: man mysqldump.):
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, and the > blog.bak.sql.bz2 sends the bzip output to a file named blog.bak.sql.bz2. It does in one line the same thing that these two commands do:
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp > blog.bak.sql bzip2 blog.bak.sql Despite bzip2 being able to compress most files more effectively than the older compression algorithms (.Z, .zip, .gz), it is [URLnf="http://en.wikipedia.org/wiki/Bzip2"]considerably slower[/URLnf] (compression and decompression). If you have a large database to dump, gzip is a faster option to use.
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp | gzip > blog.bak.sql.gz [h=2]Using MySQL Workbench[/h] [URLnf="http://dev.mysql.com/downloads/workbench"]MySQL Workbench[/URLnf] (formerly known as MySQL Administrator) is a program for performing administrative operations, such as configuring your MySQL server, monitoring its status and performance, starting and stopping it, managing users and connections, performing backups, restoring backups and a number of other administrative tasks.
You can perform most of those tasks using a command line interface such as that provided by [URLnf="http://dev.mysql.com/doc/mysql/en/mysqladmin.html"]mysqladmin[/URLnf] or [URLnf="http://dev.mysql.com/doc/mysql/en/mysql.html"]mysql[/URLnf], but MySQL Workbench is advantageous in the following respects:
[h=3]Backing Up the Database[/h] This assumes you have already installed MySQL Admin and set it up so that you can login to the MySQL Database Server either locally or remotely. Refer to the documentation that comes with the installation package of MySQL Admin for your platform for installation instructions.
[h=2]Using WordPress Database Backup Plugin[/h] [URLnf]http://www.ilfilosofo.com/[/URLnf] Austin Matzko] maintains a Plugins|WordPress plugin originally created by [URLnf="http://www.skippy.net"]Skippy[/URLnf] called [URLnf="http://wordpress.org/extend/plugins/wp-db-backup/"]WordPress Database Backup (WP-DB-Backup)[/URLnf]. It was bundled with WordPress 2.0 but is no longer included with WordPress 2.1.
[h=3]Installation[/h]
[h=3]Installation[/h]
[h=2][URLnf="http://codex.mintyviolet.com/index.php/Backing_up_your_database"]View on my Codex[/URLnf][/h]
There is no need to unzip this file to restore it. Using the same cPanel program, browse to the gz file and upload it. Once the upload is complete, the bottom of the browser will indicate dump complete. If you are uploading to a new host, you will need to recreate the database user along with the matching password. If you change the password, make the corresponding change in the wp-config.php file.
[h=2]Using phpMyAdmin[/h] phpMyAdmin is the name of the program used to manipulate your database.
Information below has been tried and tested using phpMyAdmin versions 2.5.3, 2.5.7-pl1, and 2.6.1-pl3 running on Unix.
Detailed options are listed below, though in most cases you will be fine with the default export options.
[h=3]Backup Process with phpMyAdmin[/h]
- Log into phpMyAdmin on your server
- From the main login screen, select 'Databases' (You may not need to do this step)
- Now click the name of your database - or your WordPress database if you have several databases. (Your screen may look slightly different, depending on the version.)
- The next screen will show you all the tables inside your WordPress database.
Ignore those, and click the 'Export' tab on the top set of tabs.
- Look at the left box at the top of the Export section. All the tables in the database you selected are in that box.
- If you have other programs that use the database, then choose only those tables that correspond to your WordPress install. They will be the ones with that start with "wp_" or whatever 'table_prefix' you specified in your 'wp-config.php' file.
- If you only have your WordPress blog installed, leave it as is (or click 'Select All' if you changed the selection)
- Ensure that the SQL radio button is selected.
- The SQL section
Tick the following boxes:- 'Structure'
- 'Add DROP TABLE / VIEW / PROCEDURE / FUNCTION'
- 'Add IF NOT EXISTS'
- 'Add AUTO_INCREMENT' and
- 'Enclose table and field names with backquotes'
- The DATA sectionIt doesn't matter too much what you check here. So long as you check the DATA box itself, the Complete inserts and Extended Inserts are mostly cosmetic changes to the output style, though Extended Inserts can help if you are having issues with the file size.
[URLnf="http://codex.mintyviolet.com/index.php?title=Special:Upload&wpDestFile=Backup4-1.png"]File:Backup4-1.png[/URLnf] 595px
- Tick the 'Save as file' option, and leave the template name as is.
- Now click 'Go' and you should be prompted for a file to download. Save the file to your computer.
Depending on the database size, this may take a few moments.
- You have now backed up your database.If you wanted, you could download a backup in each of the compression formats. Your choice. For example: None and "zipped":
Remember - you have NOT backed up the files and folders - such as images - but all your posts and comments are now safe.
1. Change your directory to the directory you want to dump things to:
user@linux:~> cd files/blog 2. Use mysqldump to dump all database tables. To dump only certain tables from the database, give their names at the place shown by (tablename tablename tablename), and omit the parentheses ( ) in any case. (For help, try: man mysqldump.):
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, and the > blog.bak.sql.bz2 sends the bzip output to a file named blog.bak.sql.bz2. It does in one line the same thing that these two commands do:
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp > blog.bak.sql bzip2 blog.bak.sql Despite bzip2 being able to compress most files more effectively than the older compression algorithms (.Z, .zip, .gz), it is [URLnf="http://en.wikipedia.org/wiki/Bzip2"]considerably slower[/URLnf] (compression and decompression). If you have a large database to dump, gzip is a faster option to use.
mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp | gzip > blog.bak.sql.gz [h=2]Using MySQL Workbench[/h] [URLnf="http://dev.mysql.com/downloads/workbench"]MySQL Workbench[/URLnf] (formerly known as MySQL Administrator) is a program for performing administrative operations, such as configuring your MySQL server, monitoring its status and performance, starting and stopping it, managing users and connections, performing backups, restoring backups and a number of other administrative tasks.
You can perform most of those tasks using a command line interface such as that provided by [URLnf="http://dev.mysql.com/doc/mysql/en/mysqladmin.html"]mysqladmin[/URLnf] or [URLnf="http://dev.mysql.com/doc/mysql/en/mysql.html"]mysql[/URLnf], but MySQL Workbench is advantageous in the following respects:
- Its graphical user interface makes it more intuitive to use.
- It provides a better overview of the settings that are crucial for the performance, reliability, and security of your MySQL servers.
- It displays performance indicators graphically, thus making it easier to determine and tune server settings.
- It is available for Linux, Windows and MacOS X, and allows a remote client to backup the database across platforms. As long as you have access to the MySQL databases on the remote server, you can backup your data to wherever you have write access.
- There is no limit to the size of the database to be backed up as there is with phpMyAdmin.
[h=3]Backing Up the Database[/h] This assumes you have already installed MySQL Admin and set it up so that you can login to the MySQL Database Server either locally or remotely. Refer to the documentation that comes with the installation package of MySQL Admin for your platform for installation instructions.
- Open the MySQL Admin client and login as you had previously set up to do.
- From the icon menu on the left hand side of the client window select Backup.
- If you have not already created a Backup Project, do this now by clicking on the "New Project" button at the lower part of the window and type in a name for the Backup Project where prompted.
- Select one or more databases that you want to Backup (in the MySQL Admin client these are called a "Schema" (pl. "Schemata")). Add them to the Backup Content window on the right using the right-pointing arrow button.
- When you have selected the Schema(ta), you can save the Backup Project. Or you may simply choose to Backup Now using the button on the lower right of the window.
- A dialogue will come up asking you where to put the Backup. Enter the pathname or browse to the location using the dialogue.
- Assuming all is correct (and you have write permissions in the directory to which you are writing the Backup), the backup will complete shortly.
- Open the MySQL Admin client and login as you had previously set up to do.
- From the icon menu on the left hand side of the client window select Restore.
- Click the "Open Backup File" button on the lower right of the window.
- Type in or browse to the Schema(ta) backup file and select. Click "Open".
- The Target Schema(ta) will most likely be the "Original Location", or you may choose an alternate location using the drop-down menu.
- Click the "Start Restore" button on the lower right of the window. The database restore will commence.
- Open the MySQL Admin client and login as you had previously set up to do.
- From the icon menu on the left hand side of the client window select Backup.
- If you have not already created a Backup Project, do this now by clicking on the "New Project" button at the lower part of the window and type in a name for the Backup Project where prompted.
- Select one or more databases that you want to Backup (in the MySQL Admin client these are called a "Schema" (pl. "Schemata")). Add them to the Backup Content window on the right using the right-pointing arrow button.
- When you have selected the Schema(ta), you can save the Backup Project. Or you may simply choose to Backup Now using the button on the lower right of the window.
- A dialogue will come up asking you where to put the Backup. Enter the pathname or browse to the location using the dialogue.
- Assuming all is correct (and you have write permissions in the directory to which you are writing the Backup), the backup will complete shortly.
- Open the MySQL Admin client and login as you had previously set up to do.
- From the icon menu on the left hand side of the client window select Restore.
- Click the "Open Backup File" button on the lower right of the window.
- Type in or browse to the Schema(ta) backup file and select. Click "Open".
- The Target Schema(ta) will most likely be the "Original Location", or you may choose an alternate location using the drop-down menu.
- Click the "Start Restore" button on the lower right of the window. The database restore will commence.
Name | OS (Paid edition) | OS (Free edition) | Notes |
---|---|---|---|
[URLnf="http://www.mysql.com/products/workbench/"]MySQL Workbench[/URLnf] | Windows/Mac/Linux | Windows/Mac/Linux | See [URLnf="http://codex.mintyviolet.com/index.php/Backing_up_your_database#Using_MySQL_Workbench"]above[/URLnf] |
[URLnf="http://sqlmanager.net/en/products/studio/mysql"]EMS SQL Management Studio for MySQL[/URLnf] | Windows | - | |
[URLnf="http://www.aquafold.com/"]Aqua Data Studio[/URLnf] | - | Windows/Mac/Linux | Available in 21 languages |
[URLnf="http://www.navicat.com/"]Navicat for MySQL[/URLnf] | Windows/Mac/Linux | Windows/Mac/Linux ([URLnf="http://www.navicat.com/"]Lite[/URLnf]) | Available in 8 languages |
[URLnf="http://www.webyog.com/en/"]SQLyog[/URLnf] | Windows | - | |
[URLnf="http://www.quest.com/toad-for-mysql/"]Toad for MySQL[/URLnf] | - | Windows | |
[URLnf="http://www.heidisql.com/"]HeidiSQL[/URLnf] | - | Windows | |
[URLnf="http://code.google.com/p/sequel-pro/"]Sequel Pro[/URLnf] | - | Mac | CocoaMySQL successor |
[URLnf="http://www.araelium.com/querious/"]Querious[/URLnf] | - | Mac | |
[h=3]Installation[/h]
- Search "WP-DB-Backup" on Administration_Panels|Administration > Administration_Panels#Plugins_-_Add_Functionality_to_your_Blog|Plugins Panel > Administration_Panels#Install_Plugins|Add New.
- Activate the plugin.
- The plugin will attempt to create a directory /wp-content/backup-*/ inside your WordPress directory. You may need to make /wp-content Changing_File_Permissions#Permission_Modes|writable (at least temporarily) for it to create this directory.
- Navigate to Administration_Panels|Administration > Administration_Panels#Tools_-_Managing_your_Blog|Tools > Manage_Backup_SubPanel|Backup Panel
- Select any tables, in addition to the core WordPress tables, that should be backed-up.
- Select the Backup Options; the backup can be saved on the server, downloaded, or emailed.
- Finally, click on the Backup button to actually perform the backup. You can also schedule regular backups.
[h=3]Installation[/h]
- Search "WP-DB-Backup" on Administration_Panels|Administration > [[Administration_Panels#Plugins_-_Add_Functionality_to_your_Blog|Plugins Panel > Administration_Panels#Install_Plugins|Add New.
- Activate the plugin.
- The plugin will attempt to create a directory /wp-content/backup-*/ inside your WordPress directory. You may need to make /wp-content Changing_File_Permissions#Permission_Modes|writable (at least temporarily) for it to create this directory.
- Navigate to Administration_Panels|Administration > Administration_Panels#Tools_-_Managing_your_Blog|Tools > Manage_Backup_SubPanel|Backup Panel
- Select any tables, in addition to the core WordPress tables, that should be backed-up.
- Select the Backup Options; the backup can be saved on the server, downloaded, or emailed.
- Finally, click on the Backup button to actually perform the backup. You can also schedule regular backups.
[h=2][URLnf="http://codex.mintyviolet.com/index.php/Backing_up_your_database"]View on my Codex[/URLnf][/h]