Project

General

Profile

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

Marius BĂLTEANU, 2023-11-21 00:26

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 4 Marius BĂLTEANU
h2. Step 3 - Convert database and tables
16 1 C S
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 4 Marius BĂLTEANU
More information about this topic, including how to convert the tables can be found:
26
* https://docs.nextcloud.com/server/20/admin_manual/configuration_database/mysql_4byte_support.html
27 2 C S
28
29 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.
30
31
The conversion of the character set is now complete.
32 2 C S
33
h2. Step 4 - Redmine configuration
34
35
Change in the file config/database.yml in the Redmine folder:
36
37
<pre>encoding: utf8mb4</pre>