The Ubuntu 22.04 repositories have MySQL 8. You do not need to enable any third party modules.
Make sure you do this in the following order:
- Install Virtualmin on a freshly installed OS, but don’t run the setup wizard or do config check (don’t even login, just complete the install).
- Install MySQL 8, replacing MariaDB. Make sure MariaDB is stopped/gone and MySQL starts after the change. You don’t want Webmin to start setting up MariaDB, you want it to always see MySQL databases.
- Login to Webmin and go through the setup wizard, etc. Hopefully, it Just Works. But, it’s possible you’ll need to edit the Module Configuration in the Webmin MySQL module to make it aware of where things are (historically, the config files and var paths were the same across both packages, but it’s possible names and paths have diverged, we haven’t tested MySQL in 22.04).
Also, only switch if you have a good reason to switch. There are no technical reasons to choose MySQL over MariaDB, other than you have an app that specifically uses features added to MySQL since the fork and that haven’t made it across. There are some such features (MySQL has made a number of incompatible changes, seemingly intentionally to make it harder to switch back and forth), but most of the community has embraced MariaDB, so it’s very rare to find something that doesn’t work on MariaDB. And, performance will be a wash. Neither is consistently significantly faster than the other…it’ll depend on the workload and tuning. Though the general consensus in the community is that MariaDB is somewhat faster and lighter most of the time (but, again, I don’t think anyone should consider performance a reason to switch in either direction…just that if you think switching to MySQL 8 will make your app faster than MariaDB, that’s probably wrong).