# How to move/copy mautic assets

**URL:** <https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838>\
**Category:** General Discussion\
**Tags:** community\
**Created:** [February 26, 2022, 8:56am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838 "2022-02-26T08:56:51Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [February 26, 2022, 8:56am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/1 "2022-02-26T08:56:51Z")

</div>

Hi all  
I have 4 instances of mautic working on production.  
Anyone knows how to move/copy safe for example one form or one email from 1 instance to the other?  
This is to avoid to have to recreate again the same form or email 4 times  
Thank you in advance for your help  
JR

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [February 28, 2022, 12:46pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/2 "2022-02-28T12:46:23Z")

</div>

Hi,

1. emails are stored in the table called **emails** - if know mysql, that should not be a problem. Make sure, that the templates your emails based on are also moved. MJML emails are stored in **bundle\_grapesjsbuilder** table
2. themes are in the /themes folder. You’ll need to make sure all relevant themes are moved as well.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [February 28, 2022, 12:47pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/3 "2022-02-28T12:47:15Z")

</div>

Forms - the same thing. You need to go into the DB and copy the **forms** table. Make sure to adjust form actions manually.

---

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [March 2, 2022, 7:48am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/4 "2022-03-02T07:48:09Z")

</div>

I assume that the Mautic version of the sql export and sql import should be the same ot there is a risk of that the DDBB will not work after the import right?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 6, 2022, 7:54am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/5 "2022-03-06T07:54:58Z")

</div>

These tables are pretty much the same I think.

---

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [March 10, 2022, 8:38am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/6 "2022-03-10T08:38:20Z")

</div>

Hi joeyk

Do you know where I can find the tables description in the database. I would like to know what is the content of each table.  
I am experiencing a failure trying to restore the DB because a problem with the email\_stats and it is opened a problem with the hosting company but after few days they are did not answer yet. I would like to recover some of the info needed like contacts, segments, campaigns etc  
This is the error the hosting company is looking to solve  
[Errno 1] b"ERROR 3105 (HY000) at line 2434 in file: ‘/var/lib/mysql/import-jm41423-001-marketingesdb-202203030807/marketingesdb-202203030807’: The value specified for generated column ‘generated\_sent\_date’ in table ‘email\_stats’ is not allowed."  
Thank you

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 15, 2022, 3:46pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/7 "2022-03-15T15:46:25Z")

</div>

I dont have description of each column, but the db has certain data restrictions. They are described in the table itself. I believe the column you mentioned is a datetime format.

---

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [March 15, 2022, 5:04pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/8 "2022-03-15T17:04:48Z")

</div>

Yes… I receive the following changes in the database to restore it, but I do not know how to execute the first 2 lines. I got an error when executed as SQL in phpmyadmin

sed -i ‘s/(`generated_sent_date` date).+/\1,/’ dump.sql  
sed -i ‘s/(`generated_email_domain` varchar(255)).+/\1,/’ dump.sql  
ALTER TABLE email\_stats DROP column generated\_sent\_date;  
ALTER TABLE email\_stats ADD generated\_sent\_date date GENERATED ALWAYS AS (concat(year(`date_sent`),\_utf8mb4’-’,lpad(month(`date_sent`),2,\_utf8mb4’0’),\_utf8mb4’-’,lpad(dayofmonth(`date_sent`),2,\_utf8mb4’0’))) VIRTUAL COMMENT ‘(DC2Type:generated)’;  
ALTER TABLE email\_stats DROP column generated\_email\_domain;  
ALTER TABLE email\_stats ADD varchar(255) COLLATE utf8mb4\_unicode\_ci GENERATED ALWAYS AS (substr(`email`,(locate(\_utf8mb4’@’,`email`) + 1))) VIRTUAL COMMENT ‘(DC2Type:generated)’;

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [March 15, 2022, 5:11pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/9 "2022-03-15T17:11:14Z")

</div>

Hi @jribeiro,

To do this I would use the Mautic API.

If your email comes from an external source and you want to create it identically on X Mautic instances: [Mautic Developer Documentation](https://developer.mautic.org/#create-email)

If you want to retrieve an existing email in an instance: [Mautic Developer Documentation](https://developer.mautic.org/#get-email)

Do you think this can answer your request?

Pierre

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 16, 2022, 10:28am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/10 "2022-03-16T10:28:43Z")

</div>

I think he is talking about emails as “emails to send” and the email stats table, that holds all related stats.

---

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [March 16, 2022, 11:14am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/11 "2022-03-16T11:14:02Z")

</div>

Yes the problems is that the hosting company needs to make manually the changes on the tables with generated values to allow mySQL to be restored.  
These are the changes that be performed by them and then execute de SQL sentences to allow to restore the database  
They said that this is a mySQL problem

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [March 30, 2022, 10:21am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/12 "2022-03-30T10:21:42Z")

</div>

Hello @jribeiro,

That’s why I’m telling you that the most “secure” way to do this is to use the Mautic API and not SQL queries with manual modifications that are error prone.

Pierre

---

<div class="post-metadata">

**Author:** ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)\
**Post date:** [April 1, 2022, 10:48am UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/13 "2022-04-01T10:48:26Z")

</div>

@pierre_a Could you please give me an example about how to backup the Mautic database using the API?

---

<div class="post-metadata">

**Author:** ![pierre\_a](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pierre_a/32/7031_2.png) [@pierre\_a](https://forum.mautic.org/u/pierre_a)\
**Post date:** [April 1, 2022, 4:06pm UTC](https://forum.mautic.org/t/how-to-move-copy-mautic-assets/22838/14 "2022-04-01T16:06:16Z")

</div>

Hello @jribeiro,

It is not possible to make a backup of the database via the API (it is not intended for that).

If you want to migrate an e-mail from one Mautic instance to another you can :

1. Retrieve the e-mail in the first instance: [Mautic Developer Documentation](https://developer.mautic.org/#get-email)
2. Create the e-mail in the second instance: [Mautic Developer Documentation](https://developer.mautic.org/#create-email)

I hope this will help you. 😃

Have a nice day,  
Pierre
