How to back up a MySQL database with mixed character sets in Virtualmin 8.3.0?

SYSTEM INFORMATION
OS type and version Ubuntu 22.04.5 LTS
Virtualmin version 8.3.0.

After upgrading Virtualmin from 8.1.0 to 8.3.0, backups of one of my MySQL databases started failing with the following error:

Cannot safely dump mixed column charsets: gb2312, latin1, utf8, utf8mb4. 
Use a backup method that preserves the original bytes.

I understand this is related to the recent change in charset handling:
https://github.com/virtualmin/virtualmin-gpl/commit/4bf1f73

In my case, gb2312 is used in just one column of one table.

This column is intended to support Chinese characters, although it currently contains only regular Latin text (and is almost entirely empty).

Backups worked without any reported issues before this change.

The error message suggests using “a backup method that preserves the original bytes.”

What exactly does this mean in practice? Which backup method should I use, and how can I configure it in Virtualmin?

Is there an option to disable this charset check or otherwise continue using the regular Virtualmin backup process?

I’m trying to understand how to restore my existing backup functionality without having to modify the database schema just to accommodate the new validation.

Does anyone from your support team actually read this forum?

The fact is, everything stopped working for me after your update. I understand why you made this change, but that doesn’t solve my specific problem.

If you present this forum as an official support channel, then users should actually be able to get support here. It’s been over a week now, and I still haven’t received any response.

I would appreciate at least some kind of reply from your team.

Free support on this forum not guaranteed. The developers are always busy and community users might not know the answer to your question. :smiley: , sometimes we have to wait.

I always admire people who have nothing to say about the actual technical problem but are always happy to show up and lecture others about patience. :slight_smile:

Look, I know free support doesn’t come with guaranteed response times. That’s not the point.

Virtualmin fixed something that wasn’t working properly for some users, and in the process broke something that had been working perfectly fine for me for years.

Maybe my case is unusual. I get that. But the fact remains that after this update, I can no longer use a feature that’s supposed to work.

And as far as I can see, Virtualmin itself directs GPL users to this forum for support. Their website even mentions a “brief wait.” Whether a week counts as brief is not for me to judge. I’m still hoping to hear from the people who actually develop and maintain the software.

All I’m asking is how to get the functionality back. A technical answer would be much more useful than another lecture about patience.

I haven’t answered because I don’t know an answer, and we’re all volunteers here. :man_shrugging:

But, you’re right that backups need to be extremely robust…in this case, I spent some time poking around, and the problem is the gb2312 charset, which can’t necessarily be safely converted to Unicode by the MySQL charset converter. It’s possible to lose data if dumping that charset (though not necessarily likely, as I understand it all normal characters are supported, but some possible byte pairs don’t have a Unicode representation).

So, Virtualmin is doing the right thing by not naively dumping this database, though perhaps it could do a check rather than deciding it can’t back it up with a regular dump.

I think you can test whether dumping will cause data loss with something like:

SELECT COUNT(*) AS non_roundtripping_rows
FROM your_table
WHERE HEX(your_column) <>
      HEX(CONVERT(
          CONVERT(your_column USING utf8mb4)
          USING gb2312
      ));

SHOW WARNINGS;

If that has no errors on your database, then it’s safe to dump, as it round trips through the convertor with no loss. In which case, dumping would work safely (which, I guess if you had been backing up before and those backups tested correctly, you probably don’t have unsupported code pairs in your tables). But, reading the code, I don’t see a simple way to simply allow it. It’s complicated.

I think I have to defer to @Jamie on this one, as I don’t see a simple way to enable the conversion for this charset. Perhaps the simplest thing we can do to continue to support gb2312 is to perform that test on the tables before agreeing to dump them. A more complete solution would be to convert any non-convertible data to hexadecimal representation of it, which would handle everything, even stuff that can’t be converted to Unicode.

@Aido21 Sorry for the late reply. We expect this issue to be fixed in the upcoming Webmin 2.680 release.

You could try a development build of Webmin, but only if you’re comfortable using the CLI and understand that, if you’re using the Virtualmin 7 repos, non-core Webmin modules may disappear while development Webmin version is installed.

How would Webmin fix that problem, when it’s a Virtualmin backup issue, and the code it’s running into is in Virtualmin?

Virtualmin calls a function in Webmin to backup MySQL databases.

Thanks for the reply. And for such a detailed one. :slight_smile:

I’m certainly not trying to tell anyone how this forum should be run, and I do appreciate that everyone here is a volunteer.

But in situations like mine, when I’m getting nervous because I’ve been left without working backups, even a simple “Hey, we’ve seen your post, we don’t have an answer yet, but we’re looking into it” would make a big difference.

Sometimes just knowing that your problem hasn’t gone unnoticed is enough.

Thank you guys!!!

Thank you so much. I think I will better wait till the official release.

Could you please clarify how exactly this issue will be fixed? Will backups work as they did before, without any changes on my side, or will I need to disable or reconfigure something?