# Rebuild database without reinstalling everything

**URL:** <https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [October 1, 2022, 1:09pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565 "2022-10-01T13:09:20Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [October 17, 2022, 1:57pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565/21 "2022-10-17T13:57:23Z")

</div>

@techbill, problems apparently start when you (try to) convert the database from MYISAM to InnoDB or/and change collation - utf8\_unicode\_ci or utf8mb4\_sumthing\_?

I think I’ve [solved my original issue](https://forum.mautic.org/t/csv-imports-fail-stalling-in-progress-runtime-less-than-1-second/25199/15) related to that, but my database is now a mix of InnoDB and MYISAM - some MYISAM tables won’t convert, not sure if I’d only cause more problems if I forced it somehow. Also not sure what recommended collation etc. is.

I am still curious to see an answer to the original question of this thread, how to do a clean surgical rebuild of the database without losing data and without having to reinstall everything.

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [October 17, 2022, 2:53pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565/22 "2022-10-17T14:53:50Z")

</div>

We recently converted our database from Latin to utf8 as well too.

What we did was to set up in my.cnf that it defaults to urf8 and InnoDB then export all the database from Latin. (my.cnf is only accessible by root / server admin)

We deleted and cleaned up all old database then we imported it back into which get stored as utf8 in InnoDB.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [October 17, 2022, 3:29pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565/23 "2022-10-17T15:29:37Z")

</div>

Thanks. Good info. I had set up those defaults in my.cnf, haven’t tried exporting and importing the whole database yet - no data loss?

Wasn’t utf8mb4 recommended for Mautic?

And I think converting MYISAM to InnoDB is what causes most problems.

Would simply exporting, importing a mixed MYISAM/InnoDB database into default InnoDB still work?

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [October 17, 2022, 5:47pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565/24 "2022-10-17T17:47:59Z")

</div>

No data loss as far we could see but we do have a back-up and a back-up of back-up before attempting this.

If I recalled correctly, I exported into SQL then delete the whole database completely.

I edited the my.cfg setting the default to utf8 and InnoDB then import the “SQL” back into the newly created database.

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [October 17, 2022, 5:51pm UTC](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565/25 "2022-10-17T17:51:58Z")

</div>

That was a typo in my earlier post. Sorry about that.

Yes, utf8mb4 is what I went with.

Here a partial screenshot of my parital DB after importing it back in.

 ![Screen Shot 2022-10-17 at 12.51.09 PM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/b2e85e93cd5d65fd7626bba70296df68f4ca0a16.jpeg)

[Previous page](https://forum.mautic.org/t/rebuild-database-without-reinstalling-everything/25565.md?page=1)
