How to create our local database backup with phpMyAdmin
This guide shows how to move your BitNami PHP based application Stack (like Wordpress, Drupal, Joomla!, SugarCRM and others) installed in your machine to the Cloud using BitNami Cloud Hosting
. When you finish this tutorial, we will have an exact copy of our local application installation, but in the cloud.
We will use BitNami Cloud Hosting in this Howto, but the steps are very similar for any cloud or hosting provider.
Password: The password you chose when installing the Stack.
Now select the database that uses your application, for example: "bitnami_wordpress", "bitnami_drupal", etc. Got to the Export icon.
Select "Custom" option and scroll down and tick "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement".
Make a mental note of where you save this file. We will need it later to restore the database in the remote machine.
Another possibility is using the command line. You can also get the same backup file from the BitNami Console
instead of using phpMyAdmin. This shell or command prompt has already loaded the Stack environment and you can run any command from it:
On Linux or On OS X:
$ mysqldump -u root -p bitnami_application > bitnami_application.sql
> mysqldump -u root -p bitnami_application > bitnami_application.sql
Substitute the "bitnami_application" database for your application database name (for example "bitnami_wordpress" or "bitnami_drupal"). The password is the same that you set during the installation.
How to sync files from the local machine to the remote machine
Start a new machine with your application or any other that you want to sync. Start the machine and click in "Manage". In this screen, click on "Connect".
Now click on "PPK" to download your private key file for Windows. If your local machine is Linux or OS X you should download the "PEM" key.
On Linux or OS X: You can use FileZilla or any other FTP program which supports the sFTP protocol. If you are familiar with command line you can use "rsync" or "scp" to upload the files.
On Windows: We are going to use WinSCP to copy the files to the remote machine. Open your web browser and go to http://winscp.net/eng/download.php . Click on "Installation package" to download WinSCP and install it.
If you are on Windows Vista or Windows 7, it is advisable to run the application as "Administrator" user. In other case, maybe you have not access to all files in your local installation. This is the main window of the program.
- You will need to write the URL to your remote machine in the "Host name" field, without the "http://". For example, "yourapplication.bitnamiapp.com".
- The username is "bitnami". It is not necessary a password.
- Your "private key file" is the ppk file we downloaded earlier.
Now, click on "Login".
Since it is the first time you connect to the machine, it will warn you that it can't recognize it. Click yes to continue.
The folders to the left are in your local computer, and the folders to the right are the folders of the remote computer.
In your computer, navigate to the folder you installed the BitNami Stack into, the default directory is C:\Program Files\BitNami Application Stack. Once you are there, enter the "apps" folder, and then the application folder (for example "wordpress"). You will see the same 4 folders you see in the screenshot ("conf", "htdocs", "licenses", "scripts"). You should go to htdocs folder.
On the remote computer (the folders on the right), click on the icon of folder with the slash (see the mouse pointer in the screenshot). Go to "/" folder and then follow this path "/opt/bitnami/apps/your_application/htdocs". You should see now the same folder and files in the left (your machine) and in the right (the remote machine).
Select every file on your computer (the left panel). It is important that you do not copy the database settings file which depends on the application.
After selecting the files, click the copy button near the bottom left of the screen. Click "Copy" to start the process. We want to overwrite every file in the remote host without the database settings file. Click "Yes to all". This could take some time.
How to export the database to the remote machine with phpMyAdmin
There are two options to access the remote phpMyAdmin application.
- You can create a secure pipe in your machine so any other user be able to access to the application. You can find more information at How to enable phpMyAdmin or phpPgAdmin remotely through SSH. This is the safest approach to connect to it.
- Enable phpMyAdmin to be able to access remotely. For security reasons, please revert this configuration once you finished to import the database.
Enter root as the username and your aplication password (if you don't remember it, it is available in the "Manage Server" screen from the https://app.bitnamihosting.com
Select the application database and click "Import". Then browse to the database you exported at the beginning of this Howto and Click "Go".
Some application require to restart the server. You can restart the server one last time (http://app.bitnamihosting.com
, log in, select your server and click the "Restart" button).
Finally, enjoy your new Application running in the cloud. Note that now the user credentials to access to the remote application are the same that you set in your local application.