Provide instructions on how to migrate database from utf8 to utf8mb4
Issue #1088
closed
on the upgrade documentation page http://www.mailpiler.org/wiki/current:upgrade
in chapter “from 1.3.0 to 1.3.5“ you describe step by step how to keep the utf8 charset but not how migrate from utf8 to utf8mb4.
But since new piler installations use the utf8mb4 this would be the preferred path to take for an upgrade also. But for this procedure you just refer to an Bitbucket issue from 2016. For me it is not clear from this issue which steps need to be taken.
Please provide step by step instructions on how to migrate the piler database from utf8 to utf8mb4.
Comments (2)
-
reporter -
repo owner - changed status to closed
Thanks for the procedure, I've linked it to the FAQ.
- Log in to comment
I figured out how to upgrade mailpiler from version 1.3.0 to 1.3.8 and wrote this little howto.
All the commands are for Centos 7 - for other os like debian you need to adjust.
the general sources I used for information:
*http://www.mailpiler.org/wiki/current:upgrade
*http://www.mailpiler.org/wiki/current:installation
*http://www.mailpiler.org/wiki/current:post-install
*https://community.spiceworks.com/how_to/138923-how-to-install-mailpiler-on-centos-7
*http://wiki.ozanh.com/doku.php?id=linux:debian:mailpiler:web-configuration
Make a backup before you upgrade! Especially the database is crutial for mailpiler. Be sure you can roll back to a working installation.
Disable all piler cronjobs to avoid modification of the database and mail store during the upgrade process
stop all Piler daemons to make sure no new mail is added during the upgrade process
update the OS
make sure all needed packages are installed and up to date
Mailpiler 1.3.0 used PHP 5.x, mailpiler 1.3.8 now uses PHP 7.x - change from PHP 5.4 to PHP 7.4 :
remove PHP 5.4
install PHP 7.4 - it is not part of the Centos Repo, you need to add REMI Repo - https://www.tecmint.com/install-php-7-in-centos-7/#
install needed PHP 7.4 Modules
make sure all helper program packages are installed and up to date
Mailpiler 1.3.0 used the utf8 character set in the database, mailpiler 1.3.8 now uses utf8mb4 by default.
if you want to keep the utf8 character set see instructions at http://www.mailpiler.org/wiki/current:upgrade "from 1.3.0 to 1.3.5" on how to do that.
I made the decision to change the character set from utf8 to utf8mb4
sources I consulted for the necessary steps:
*http://www.mailpiler.org/wiki/current:upgrade "from 1.3.0 to 1.3.5"
*https://bitbucket.org/jsuto/piler/issues/709/mysql_stmt_execute-error-incorrect-string
*https://bitbucket.org/jsuto/piler/issues/895/reference-convert-piler-database-to
*https://bitbucket.org/jsuto/piler/issues/899/interface-just-shows-search-mails-from
each of these sources contains only a part of the necessary database changes.
I combined all of them and added additional changes to the database columns that I found by comparing the databases from 1.3.0 and 1.3.7
change Character Set of the database
apply all changes to the database columns that were modified from 1.3.0 to 1.3.7
change Character Set of the tables
actual Mailpiler upgrade
Do not run 'make postinstall' ! this might overwrite your Config Files and Encryption Key in /usr/local/etc/piler !
'make install' created new config files named ".dist" in /usr/local/etc/piler
compare these new config files with your old config files and merge the changes by hand.
make sure the www/tmp directory can be accessed by the web server
start Piler daemons again
Mailpiler 1.3.8 has two new cron jobs, add them to the piler crontab
add lines
and enable all piler cronjobs again
The upgrade is done - test that everything is working correctly again...
The upgrade instructions at http://www.mailpiler.org/wiki/current:upgrade were not quite living up to the expectation that the first sentence
gave me.
I hope my write up can help to improve the documentation.