How to Move Mautic to Another Server
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:
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:
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):
And to grant access:
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:
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:
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!