HowTo convert a database from utf8 to utf8mb4 » History » Revision 3
Revision 2 (C S, 2021-11-11 15:18) → Revision 3/5 (C S, 2021-11-11 15:19)
h1. HowTo convert a mysql database from utf8 to utf8mb4
First things you have to do is like an upgrade
h2. Step 1 - Check requirements
The first step to upgrading Redmine is to check that you meet the [[RedmineInstall#Requirements|requirements]] for the version you're about to use or install.
h2. Step 2 - Backup
It is recommended that you backup your database and file uploads. Most upgrades are safe but it never hurts to have a backup just in case.
To understand how to back up your Redmine, please read [[RedmineBackupRestore|Backing up and restoring Redmine]].
h2. Step 3 - Convert
When using a database with a current mySQL version, the conversion is already done with a single command line
<pre>
<code class="sql">
ALTER DATABASE redmine DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
</code>
</pre>
More information on this topic was found here: https://docs.nextcloud.com/server/20/admin_manual/configuration_database/mysql_4byte_support.html
If you use an assistant such as _phpMyAdmin_, you can simply select the database there and select the item _Collation_ under the _Operations_ tab.
The conversion of the character set is now complete.
h2. Step 4 - Redmine configuration
Change in the file config/database.yml in the Redmine folder:
<pre>encoding: utf8mb4</pre>