Migration Tool 1.0.5 MariaDB

Issue Description

When Trying to Migrate with Migration Tool 1.0.5 execution on old server from mariadb (mysql) to new mariadb (mysql)

2026-11-01T18:55:13.349880Z ERROR stalwart_migrate: command failed error=the v1 --target is a v0.16 store; the target must be a separate, new store

But it is an empty DB.

MariaDB [stalwart]> show tables;
Empty set (0,002 sec)

The Connection settings are correct. If I stop the new mariadb server then:
2026-11-01T19:04:33.023345Z ERROR stalwart_migrate: command failed error=cannot check the v1 target: fatal error: cannot check that the v1 target is a new empty store, refusing to open it: transient error: MySQL error (store.mysql-error): reason = Input/output error: Input/output error: Connection refused (os error 111), causedBy = vendor/v1/crates/store/src/dispatch/store.rs:296

When I restart mariadb:

2026-11-01T19:05:54.082550Z ERROR stalwart_migrate: command failed error=the v1 --target is a v0.16 store; the target must be a separate, new store

Stalwart Version

v0.16.x

Installation Method

Binary (Linux)

Database Backend

MySQL

Blob Storage

MySQL

Search Engine

MySQL

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

That message only comes up when the database the tool connects to has a p table with the v0.16 schema version row in it. On an empty database the check finds no tables and lets the run through, so whatever --target points at isn’t the empty stalwart database you looked at. The connection refused error when you stop the new server shows the host is right, which leaves the database name, the port or the user, or a new server that already holds a copy of the old data (a restored dump or replication).

Could you post your target config.json with the password removed, and run this from the old server with exactly the host, port, user and database from that file?

mysql -h HOST -P PORT -u USER -p DATABASE -e "SELECT DATABASE(); SHOW TABLES; SELECT HEX(v) FROM p WHERE k = 0x00;"

Yes of course.

{"@type":"MySql","idleTimeout":15000,"useTls":false,"allowInvalidCerts":false,"maxAllowedPacket":null,"poolMaxConnections":null,"poolMinConnections":5,"readReplicas":{},"host":"10.129.17.10","port":3306,"database":"stalwart","authUsername":"stalwart","authSecret":{"@type":"Value","secret":"******"}}

root@sdeb0202:/new# mysql -h 10.129.17.10 -P 3306 -u stalwart -p stalwart -e "SELECT DATABASE(); SHOW TABLES; SELECT HEX(v) FROM p WHERE k = 0x00;"
Enter password:
+------------+
| DATABASE() |
+------------+
| stalwart   |
+------------+

SELECT HEX(v) FROM p WHERE k = 0x00

ERROR 1146 (42S02) at line 1: Table 'stalwart.p' doesn't exist

The tool’s check reads the same p table your query just reported missing, and it can only print “is a v0.16 store” when that table exists and holds the schema version row. So on November 1 the connection the tool made saw a stalwart database with v0.16 tables in it, and on November 2 the same database is empty.

Could you run the same stalwart-migrate command again now, with 1.0.6, and post the full command line and its output? If it still refuses, run this right after it, from the same machine:

mysql -h 10.129.17.10 -P 3306 -u stalwart -p stalwart -e "SHOW TABLES; SELECT @@hostname, @@port;"

Yes, when 1.0.6 is released.

My mistake, 1.0.6 isn’t out yet; 1.0.5 is the current release. Nothing in the target checks has changed between the two, so there’s no need to wait: please run the same stalwart-migrate command with 1.0.5 now and post the full command line and its output. If it refuses again, run the mysql query from my last post straight after it, from the same machine.

/new/config.json:
{"@type":"MySql","idleTimeout":15000,"useTls":false,"allowInvalidCerts":false,"maxAllowedPacket":null,"poolMaxConnections":null,"poolMinConnections":5,"readReplicas":{},"host":"10.129.17.10","port":3306,"database":"stalwart","authUsername":"stalwart","authSecret":{"@type":"Value","secret":"******"}}

/srv/stalwart/etc/config.json:
{"@type":"MySql","timeout":15000,"useTls":false,"allowInvalidCerts":false,"maxAllowedPacket":null,"poolMaxConnections":10,"poolMinConnections":5,"readReplicas":{},"host":"localhost","port":3306,"database":"stalwart","authUsername":"stalwart","authSecret":{"@type":"Value","secret":"******"}}

root@sdeb0202:/# stalwart-migrate prepare --source /srv/stalwart/etc/config.json --state /var/lib/stalwart-migrate

root@sdeb0202:/# stalwart-migrate run --source /srv/stalwart/etc/config.json --target /new/config.json --state /var/lib/stalwart-migrate
2026-11-05T15:00:52.037165Z WARN migrate::commands::run: running as root without --owner: files created for the target will be owned by root and a v1 container running as uid 2000 may not be able to open them
2026-11-05T15:00:52.231097Z ERROR stalwart_migrate: command failed error=the v1 --target is a v0.16 store; the target must be a separate, new store

root@sdeb0202:/# mysql -h 10.129.17.10 -P 3306 -u stalwart -p stalwart -e "SHOW TABLES; SELECT @@hostname, @@port;"
Enter password:
+------------+--------+
| @@hostname | @@port |
+------------+--------+
| sdeb0202 | 3306 |
+------------+--------+

root@sdeb0202:/# mysql -h 10.129.17.10 -P 3306 -u stalwart -p stalwart -e "SELECT DATABASE(); SHOW TABLES; SELECT HEX(v) FROM p WHERE k = 0x00;"
Enter password:
+------------+
| DATABASE() |
+------------+
| stalwart   |
+------------+

SELECT HEX(v) FROM p WHERE k = 0x00

ERROR 1146 (42S02) at line 1: Table 'stalwart.p' doesn't exist

Same as before.

I owe you a correction: the target never held old data, and my earlier replies were looking in the wrong place. The problem is in the MySQL client library the tool uses.

On Linux, mysql_async connects over TCP to the host you configured, asks that server for its socket path (@@socket), and then quietly reconnects through that Unix socket on the local machine. It never checks whether the host is actually local. Both of your MariaDB servers run on sdeb0202, and the new one most likely reports the distribution’s default socket path, which on that machine belongs to the old v0.16 server. So the tool dialled 10.129.17.10 (which is why stopping the new server gave you “connection refused”), then switched to the socket and ended up reading the old database. The refusal you hit was the safety check doing its job: without it, run would have written the v1 data into your v0.16 database.

The fix turns that socket switch off, so the tool always stays on the host and port in the config. The Stalwart v1 server had the same behaviour and gets the same fix. It ships in the next stalwart-migrate release, and in the next weekly Stalwart release for the server.

You don’t need to wait for it. Give the new MariaDB its own socket path in its [mysqld] section, for example:

[mysqld]
socket = /run/mysqld/mysqld-new.sock

Restart the new server and run stalwart-migrate run again with the same command. SELECT @@socket; on each server should now show two different paths.

The running as root without --owner warning in your output doesn’t matter here. It’s about files the tool creates for the target, and with a MySQL target for data, blobs and search there aren’t any.

Perfect. All is fine.