From a65fa8cf10ac869feabb3d85253d29a2cf245b2f Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 17 Feb 2024 01:33:34 -0500 Subject: [PATCH] [U] Finalize mysql migration guide --- docs/mysql_to_mariadb.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/mysql_to_mariadb.md b/docs/mysql_to_mariadb.md index 2f9615c0..541f46e4 100644 --- a/docs/mysql_to_mariadb.md +++ b/docs/mysql_to_mariadb.md @@ -33,27 +33,39 @@ services: Run the following command to export your data from MySQL. Please fill in the fields in the curly braces with your MySQL database details. +To prevent charset encoding issues, please run the following command on Linux / macOS. +For some reason Windows is still not using UTF-8 by default in 2024. + ```bash mysqldump --user={username} --password={password} --host={host} --port={port} {database} > aqua.sql ``` +Now `aqua.sql` should be created. Please open `aqua.sql` and check if `utf8mb4_0900_ai_ci` exists. +If it does, you're running a higher version of MySQL, please replace `utf8mb4_0900_ai_ci` with `utf8mb4_general_ci` in the `aqua.sql` file. + +```bash +# A command to replace the strings as mentioned above (Linux / macOS only). +sed -i 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' aqua.sql +``` + ### 3. Import Data to MariaDB Run the following command to import your data to MariaDB. Please fill in the fields in the curly braces with your MariaDB database details. +First, login to your MariaDB server. + ```bash -mysql --user={username} --password={password} --host={host} --port={port} {database} < aqua.sql -``` - -### 4. Fix Flyway Schema History - -AquaDX uses Flyway to manage database schema migrations. Most migrations were identical, but one migration used different case for MySQL and MariaDB, so we need to fix its checksum. - -```shell -# Connect to your MariaDB server mysql --user={username} --password={password} --host={host} --port={port} {database} ``` +Then, import the data. + +```sql +source aqua.sql; +``` + +Finally, we need to fix a flyway checksum. Aqua uses Flyway to manage database schema migrations. Most migrations were identical, but one migration used different case for MySQL and MariaDB, so we need to fix its checksum. + Run the following SQL query to fix the checksum. ```sql