I have a wordpress site withh mysql database on apache on Ubuntu and I want to move this website with the database to Ubunto 16.04 on Azure?

March 4, 2017 145 views
Apache Ubuntu 16.04

How can I do that, and I want to install SSL with a certificate I have it,

4 Answers


For Apache, you can use LetsEncrypt to setup a free SSL using the following guide:

Exporting your current MySQL database can be done through phpMyAdmin, Adminer, or from the CLI using mysqldump.

For example, using the CLI you'd use something such as:

mysqldump -u DBUSER -p DBNAME > database.sql

DBUSER = Your Database Username
DBNAME = Your Database Name

When the command above is ran, you'll be prompted for a password. You'll use the password that you use for your database. Depending on the size of your database, it'll take a few seconds to minutes to export to the file.

On the new server, you can restore the database (to an empty database) using:

mysql -u DBUSER -p DBNAME < database.sql
This tutorial will show you how to set up a free TLS/SSL certificate from Let’s Encrypt on a Ubuntu 16.04 server running Apache as web server. TLS certificates are used within web servers to encrypt the traffic between server and client, providing extra security for users accessing your application.

I recommend exporting your Wordpress site. To do this, you go to Dashboard > Tools > Export.
This will also export your users, which I assume is why you want to export your database. To import your Wordpress site, install Wordpress and simply go to Dashboard > Tools > Import and upload your file.

Hope this helped you!

  • But my website is on Ubuntu and I want export also the database. I deployed a Ubuntu on Azure and Installed Apache, created a database and I installed Wordpress. But there are many configuration | should to do it, like Postfix with SMTP, HTTPS using a free certificate.
    and I should to configure all these on Ubuntu on Azure

    • What are you using Postfix and SMTP for in your configuration? You could always use Letsencypt and Certbot for the HTTPS Certificates.

The above method works, however does not migrate your theme or any installed plugins. A different method if you have SSH access on both servers is:

  1. SSH to you old server ssh username@old_server_ip and navigate to your web root cd /path/to/old_webroot
  2. Export your WordPress database mysqldump -p -u DBUSER DBNAME > DBNAME.sql and enter the database password when prompted.
    • *NOTE: Your Wordpress database information can be found in the wp-config.php file if you do not remember. *
  3. Migrate file(s) to the your new server scp -r /path/to/old_webroot/* username@new_server_ip:/path/to/new_webroot. This will copy all your WordPress file(s) and the database export from your current server to the new server.
  4. SSH to your new server ssh username@new_server_ip and navigate to the web root cd /path/to/new_webroot
  5. Import your WordPress database mysql -p -u DBUSER DBNAME < DBNAME.sql.
    • NOTE: Database access will need to be setup prior to this step.

You will need to update your wp-config.php file with the new database credentials if they have changed. Once you verify your site is working on the new server, be sure to delete the DBNAME.sql file.

Another method is to use a migration plugin:

Some resources:

by Ramesh Jha
If you read through this article you'll have the knowledge to migrate your WordPress site from Shared Hosting to a Cloud Server with zero downtime.
Have another answer? Share your knowledge.