Project

General

Profile

HowTo convert a database from utf8 to utf8mb4 » History » Version 3

C S, 2021-11-11 15:19

1 3 C S
h1. HowTo convert a mysql database from utf8 to utf8mb4
2 1 C S
3
First things you have to do is like an upgrade
4
5
h2. Step 1 - Check requirements
6
7
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.
8
9
h2. Step 2 - Backup
10
11
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.
12
13
To understand how to back up your Redmine, please read [[RedmineBackupRestore|Backing up and restoring Redmine]].
14
15
h2. Step 3 - Convert
16
17 2 C S
When using a database with a current mySQL version, the conversion is already done with a single command line
18 1 C S
19
<pre>
20
<code class="sql">
21
ALTER DATABASE redmine DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
22
</code>
23
</pre>
24
25 2 C S
More information on this topic was found here: https://docs.nextcloud.com/server/20/admin_manual/configuration_database/mysql_4byte_support.html
26
27
28 1 C S
If you use an assistant such as _phpMyAdmin_, you can simply select the database there and select the item _Collation_ under the _Operations_ tab.
29
30
The conversion of the character set is now complete.
31 2 C S
32
h2. Step 4 - Redmine configuration
33
34
Change in the file config/database.yml in the Redmine folder:
35
36
<pre>encoding: utf8mb4</pre>