Topic: iRedMail migration to new server - SQL data only
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Debian 10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): nginx - what else
- Manage mail accounts with iRedAdmin-Pro? yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Dear all,
I'm in the process of migrating an existing updated iRedMail 1.3.1 installation on Ubuntu 16.04 Server to a new deployment on Debian 10.
On the old server we use MySQL, the new server has MariaDB installed.
Now I would like to transfer the SQL data from A (old) to B (new).
A simple "mysqldump > dump.sql" and "mysql < dump.sql" is undesired as it takes over the complete old structure as well.
I tested the procedure and all works well BUT
The table structure, indizes and default values do differ substancially.
I would like to keep the proper new table layout from the fresh installation but insert all the data from the old server.
So far so good.
Backup data only on machine A:
mysqldump --default-character-set=utf8mb4 --no-create-info --skip-triggers --no-create-db --compact --databases amavisd fail2ban iredadmin iredapd roundcubemail vmail >/tmp/dump.sql
Restore in two steps on B, first
mysql < clean.sql
clean.sql contains only "truncate" statements to empty all tables. This keeps the nice new layout for us.
then after copying the dump.sql vis SCP to B
mysql < /tmp/dump.sql
This should restore all data.
Basically this should work but for some reason I get an error:
ERROR 1366 (22007) at line 16: Incorrect string value: '\xF0\x9F\xA4\xAB N...' for column `amavisd`.`msgs`.`from_addr` at row 101
Looks like some emoji or other unicode characters were in an address.
This is where I'd like to seek help.
Why can I restore the complete database dump with create statements but it fails with only the data?
The charset setting on both tables looks like to be the same.
@iRedMail:
It would be great to see https://docs.iredmail.org/migrate.to.ne … erver.html updated with some notes about the SQL data migration.
IMHO restoring the old database with the old table structure is bad and might cause issues with e.g. predefined and expected defaults when missing.
Thanks!
Best regards,
Bernhard
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.