Dump the whole database:
mysqldump -u myuser my_database -p > dump.sql
Open the dump.sql
file.
Do a search and replace: for example replace all occurrences of utf8mb3
with utf8mb4
.
Save the file.
Open mysql:
mysql -u myuser -p
Delete the database, recreate it, and use it:
drop database my_database;
create database my_database;
use my_database;
Import the dump:
source dump.sql
Or simply tell mariadb/mysql to use another encoding before doing the migration so it sticks to the used one:
ALTER DATABASE my_database COLLATE = 'utf8mb3_general_ci';
This will make sure that the created table(s) use the same collation