How to Move Mautic to Another Server

Written by
on September 21, 2017

So you have Mautic running on your web server along with your website, but now you need to move Mautic along with your website to a new server? Good news! Migrating Mautic to another server is a walk in the park.

The instructions below are going to show you how to dump the mysql database from the command line in Debian/Ubuntu, import to a new db and migrate your Mautic installation. Let’s get to it!

Export Your MySQL Database

Assuming the name of your database is ‘mymautic’ and your username is ‘henry’ type the following at the command line:

mysqldump -u henry -p mymautic > whateveryouwant.sql

The – u signifies ‘username’ and the -p signifies ‘password’ which you’ll be prompted for after entering in the above. The contents of your database will now be in the ‘whateveryouwant.sql’ file, and that will most likely be in your server /root/ directory. Not the server root, but the ‘root’ directory — That tripped me up in the past!

Create New Database & User

Create a new database on the new server. Sign into MySQL:

mysql -u root -p

Then type in the following, assuming you’re going to use the same db name and user name as above (you don’t have to):

create database;

And to grant access:

grant all on mymautic.* to ‘henry’ identified by ‘put-a-tough-password-here’;

Be sure to actually use the single quotes in the command above. Now you’re ready to import.

Import to New Database

It’s time to import. Copy the ‘whateveryouwant.sql’ file to the same /root/ directory on the new server. Then type:

mysql -u henry -p -h localhost mymautic < whateveryouwant.sql

Copy Mautic Files

Nice! The hardest part of your Mautic migration is done. Now copy your Mautic sub folder to the same place on your new server. Once the copy is finished, make sure www-data has proper rights. Assuming Mautic is contained in a ‘content’ folder, type in the following:

chown -R www-data:www-data /var/www/yoursite.com/public_html/content/

Your Mautic migration is almost done!

Edit Config File & Clear Cache

Open the /content/app/config/local.php file and update the database name, user and password (if different). Then delete the /content/app/cache folder.

Make sure your nginx server block file is configured to look in the right folder and you’re ready to go. See installing Mautic in a subfolder for more information.

That’s it! As promised, moving Mautic to another server is a walk in the park!

 

Written By

Kyler Boudreau

Kyler Boudreau lives with his wife and daughter on the beautiful island of Kauai. Kyler is an independent filmmaker (see theatereleven.com). His wife, Sandi Boudreau, is a Crown Diamond level distributor with Young Living.

Connect with Kyler

Leave a Reply

Your email address will not be published. Required fields are marked *