How can I do that, and I want to install SSL with a certificate I have it,
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:
DBUSER
= Your Database UsernameDBNAME
= Your Database NameWhen 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:
I’d use this plugin: https://wordpress.org/plugins/all-in-one-wp-migration/
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:
ssh username@old_server_ip
and navigate to your web rootcd /path/to/old_webroot
mysqldump -p -u DBUSER DBNAME > DBNAME.sql
and enter the database password when prompted.wp-config.php
file if you do not remember. **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.ssh username@new_server_ip
and navigate to the web rootcd /path/to/new_webroot
mysql -p -u DBUSER DBNAME < DBNAME.sql
.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 theDBNAME.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!