Question

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?

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

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@mohamdsip

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

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

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

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. **
  1. 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.
  2. SSH to your new server ssh username@new_server_ip and navigate to the web root cd /path/to/new_webroot
  3. 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:

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!