MySQL 8.0 End of Life: Move an Ubuntu 24.04 Server to MariaDB

On this pageMySQL 8.0 end of life on Ubuntu 24.04: do you have to move now?
  1. MySQL 8.0 end of life on Ubuntu 24.04: do you have to move now?
  2. Before you start: inventory the MySQL 8.0 server
  3. Stop writes, take the baseline, dump MySQL 8.0
  4. Unknown collation utf8mb4_0900_ai_ci: the map that keeps MySQL’s behavior
  5. Switch the packages: what apt does to /var/lib/mysql
  6. caching_sha2_password on MariaDB: recreate the users first
  7. Import the dump into MariaDB 10.11
  8. Verify the import: counts, a content hash, and the CHECKSUM TABLE trap
  9. Settings that change silently after the switch
  10. Cut over: check the app’s logins, then reopen writes
  11. Roll back to MySQL 8.0 from the cold copy
  12. The other path: upgrade MySQL 8.0 to 8.4
  13. What this means for you
MySQL 8.0 end of life: database boxes carried from one server to another, with one small sticker on a box arriving intact
If your Ubuntu 24.04 server runs MySQL 8.0 from apt, the MySQL 8.0 end of life on April 30, 2026 did not leave it unpatched. The package changelog has three security entries dated since then, and the latest reached users as USN-9046-1 on November 11. If you move to MariaDB 10.11 anyway, skip the usual fix of renaming utf8mb4_0900_ai_ci to utf8mb4_unicode_ci, which can break unique keys. Map it to utf8mb4_uca1400_nopad_ai_ci: in the lab comparisons below, it was the only candidate that matched MySQL's equality results and sort order.

Your database holds the posts, orders and logins your site depends on. After the MySQL 8.0 end of life, Oracle no longer maintains the version Ubuntu 24.04 installs; Ubuntu still patches its own copy but has not said for how long. Moving to MariaDB, the community fork of MySQL, is a common way out.

Rehearse first on a spare Ubuntu 24.04 machine; a Hostry KVM VPS starts a clean 24.04 with root access in seconds. The outputs shown come from a test container (2 vCPU, 8 GB RAM) running mysql-server 8.0.46-0ubuntu0.24.04.5 and mariadb-server 10.11.14 from Ubuntu’s repositories, with a synthetic WordPress-like database of 290 MB. wpsite and wp_app are lab names; use your own.

MySQL 8.0 end of life on Ubuntu 24.04: do you have to move now?

Not this week, if the server runs Ubuntu’s package and installs security updates. Oracle publishes no more 8.0 releases, so fixes now come from Ubuntu backporting patches onto 8.0.46, the last upstream release (April 7, 2026). Your package changelog shows it:

zcat /usr/share/doc/mysql-client-core-8.0/changelog.Debian.gz | head -52
mysql-8.0 (8.0.46-0ubuntu0.24.04.5) noble-security; urgency=medium
  * SECURITY UPDATE: October 2026 security issues
    - debian/patches/2026-10-security.patch
    - CVE-2026-101607, CVE-2026-101608, [...]
 -- [...]  Mon, 26 Oct 2026 14:04:27 -0500
mysql-8.0 (8.0.46-0ubuntu0.24.04.4) noble-security; urgency=medium
  * SECURITY UPDATE: July 2026 security issues
    - debian/patches/2026-07-security.patch
    - CVE-2026-46936, CVE-2026-47012, [...]
 -- [...]  Wed, 26 Aug 2026 08:41:48 -0400
mysql-8.0 (8.0.46-0ubuntu0.24.04.3) noble-security; urgency=medium
  * SECURITY UPDATE: Denial of service via repeated TLS upgrades
    [...]
  * SECURITY UPDATE: Denial of service via out-of-bounds read
    [...]
 -- [...]  Fri, 19 Jun 2026 13:14:09 -0400

The three entries dated after April 30 (June 19, August 26 and October 26) list 2, 29 and 64 CVE IDs. The last two are patch sets on top of 8.0.46; dates mark the build. The October set reached users as USN-9046-1 on November 11, 2026, which says the 22.04 and 24.04 packages “have been updated with backported patches”.

Ubuntu 24.04’s standard security maintenance covers packages in main, including mysql-server-8.0, until May 2029. Canonical has not written that it will keep backporting MySQL 8.0 fixes for that whole period.

OptionWhere the package comes fromSupport endsWork involved
Stay on MySQL 8.0Ubuntu 24.04, mainUpstream ended April 30, 2026; Ubuntu backports with no stated endNone now; move before or with the OS upgrade
MySQL 8.4 LTSUbuntu 26.04 archive, or Oracle’s apt repository on 24.04April 30, 2032In-place upgrade; login plugin changes (docs only here)
MariaDB 10.11Ubuntu 24.04, universe (10.11.14)February 16, 2028 (community)Dump and import, collation map, new passwords: the path below
MariaDB 11.8 or 12.3MariaDB’s own repositoryJune 4, 2028 / June 12, 2029Same dump path; 0900 names accepted as aliases (docs only here)

WordPress supports both MariaDB and MySQL 8.4: the WordPress hosting handbook, updated November 24, 2026, recommends MySQL 9.7 and 8.4 and MariaDB 12.3, 11.8, 11.4 and 10.11. What differs is the work: 8.4 upgrades the data files in place (see the 8.4 path at the end), while any MariaDB version needs a dump and an import.

We would leave a healthy 24.04 server on Ubuntu’s 8.0 package for now and schedule the move. Choose MariaDB 10.11 to leave Oracle’s line using only Ubuntu’s archive, and accept its limits: the package sits in universe, outside standard security maintenance, and its 10.11.14 build trails upstream’s 10.11.20. The choice resembles the one for PostgreSQL 14 after its November 12 end of life.

MySQL 8.0 end of life migration to MariaDB 10.11 on Ubuntu 24.04: stop writes and dump, rewrite collations, cold copy and install MariaDB, recreate users, import, verify and reopen writes, with a rollback to the cold copy
The order of the migration, with the rollback branch that starts from your cold copy.

The steps, in order:

  1. Inventory the server and prepare the checks
  2. Stop writes, take the baseline, dump
  3. Rewrite the collations
  4. Copy the data directory and switch packages
  5. Recreate the users
  6. Import
  7. Verify
  8. Restore the settings that changed
  9. Cut over and reopen writes
  10. Roll back if needed

Before you start: inventory the MySQL 8.0 server

Five things decide whether the import succeeds first time: collations, login plugins, objects that run as a named user, the event scheduler and your largest row. Check them from one working directory:

mkdir -p ~/migrate && cd ~/migrate
sudo mysql -e "SELECT DISTINCT COLLATION_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='wpsite'"
sudo mysql -e "SELECT DISTINCT TABLE_COLLATION FROM information_schema.TABLES WHERE TABLE_SCHEMA='wpsite'"
sudo mysql -e "SELECT user, host, plugin FROM mysql.user WHERE user NOT LIKE 'mysql.%'"
sudo mysql -e "SELECT DEFINER FROM information_schema.VIEWS WHERE TABLE_SCHEMA='wpsite' UNION SELECT DEFINER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA='wpsite' UNION SELECT DEFINER FROM information_schema.TRIGGERS WHERE TRIGGER_SCHEMA='wpsite' UNION SELECT DEFINER FROM information_schema.EVENTS WHERE EVENT_SCHEMA='wpsite'"
sudo mysql -e "SELECT @@event_scheduler, @@max_allowed_packet"
grep -E "DB_CHARSET|DB_COLLATE" /var/www/example.com/wp-config.php

The collation queries also return a NULL row: number and date columns have no collation, and neither do views in the tables list. Ignore it; only the named collations matter.

A collation is the rule set that decides which strings count as equal and how they sort. Note every name containing 0900: MariaDB 10.11 knows none of them. WordPress normally creates its tables with utf8mb4_unicode_520_ci, which MariaDB supports. If DB_COLLATE in wp-config.php names a 0900 collation, change it too. Users with caching_sha2_password will need new passwords, and a DEFINER is the account a view, trigger, procedure or event runs as.

For the largest row and the disk (not run in the lab; use your own big text columns):

sudo mysql -e "SELECT MAX(LENGTH(post_content)) FROM wpsite.wp_posts; SELECT MAX(LENGTH(meta_value)) FROM wpsite.wp_postmeta; SELECT MAX(LENGTH(option_value)) FROM wpsite.wp_options"
df -h /var/lib/mysql ~/migrate
sudo du -sh /var/lib/mysql

A value above 16777216 means you must raise the packet limit before the import. Free space should exceed the du figure, for the cold copy, plus the dump; the lab’s 204 MB dump came from a 313 MB database directory.

Prepare the two check scripts

Save the lab’s count script as verify-counts.sh and run chmod +x verify-counts.sh. It runs an exact COUNT(*) on every base table:

#!/bin/bash
# usage: verify-counts.sh "<client command>" <db>   -> prints "table rows" for every base table, exact COUNT(*)
CLI="$1"; DB="$2"
for t in $($CLI -N -e "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA='$DB' AND TABLE_TYPE='BASE TABLE' ORDER BY TABLE_NAME"); do
  printf "%s\t%s\n" "$t" "$($CLI -N -e "SELECT COUNT(*) FROM \`$DB\`.\`$t\`")"
done

The content hash takes an MD5 of each table’s stored values in primary-key order, independent of either engine’s file format. Save it as verify-content.sql, with the SET line first and one SELECT per table. Wrap every text column in HEX(), slugs and keys included, so the hash covers the stored bytes; JSON columns can go in the same way. Two lines show the pattern:

SET SESSION group_concat_max_len = 1073741824;
SELECT 'wp_postmeta', COUNT(*), MD5(GROUP_CONCAT(CONCAT_WS('|', meta_id, post_id, HEX(meta_key), HEX(meta_value)) ORDER BY meta_id SEPARATOR '\n')) FROM wp_postmeta
UNION ALL SELECT 'wp_terms', COUNT(*), MD5(GROUP_CONCAT(CONCAT_WS('|', term_id, HEX(name), HEX(slug)) ORDER BY term_id SEPARATOR '\n')) FROM wp_terms;

Do not skip the SET line. A lab rerun without it found MySQL 8.0’s 1024-byte GROUP_CONCAT default silently cut 5 of 7 tables and produced a false DIFF. The only sign is a warning that appears with --show-warnings:

Warning (Code 1260): Row 8 was cut by GROUP_CONCAT()

Treat any Warning 1260 as a failed check, and hash very large tables in primary-key ranges. Run both scripts now as a trial; the files you compare come later, after writes stop.

Stop writes, take the baseline, dump MySQL 8.0

To migrate MySQL 8 to MariaDB on Ubuntu, you write the data out as SQL statements and replay them on the new server. A dump is the only way across, because MariaDB cannot open MySQL 8.0’s data files. Stop application writes first, so nothing changes after the baseline. Either of these works for WordPress (not run in the lab):

sudo -u www-data wp maintenance-mode activate --path=/var/www/example.com
sudo systemctl stop php8.3-fpm

Then, from ~/migrate, capture the comparison files and take the dump right after:

./verify-counts.sh "sudo mysql" wpsite > counts-mysql80.txt
sudo mysql --show-warnings wpsite < verify-content.sql > fp-mysql80.txt
sudo mysqldump --single-transaction --routines --triggers --events \
  --set-gtid-purged=OFF --hex-blob --databases wpsite > wpsite-mysql80.sql

--single-transaction reads InnoDB tables from one consistent snapshot without locking them. --hex-blob writes binary columns as hex, and --set-gtid-purged=OFF keeps GTID statements out of the file. Use MySQL’s own mysqldump, as MariaDB’s migration guide also advises. Lab timings:

wpsite: elapsed 0.12 s, maxrss 9080 KB, 4495874 bytes
wpbig : elapsed 2.32 s, maxrss 8924 KB, 214164751 bytes (204 MB)

Name your application databases after --databases. A trial with --all-databases on a throwaway MariaDB replaced 32 tables of its mysql schema with MySQL 8.0 definitions, then stopped:

ERROR 1050 (42S01) at line 924: Table 'user' already exists

MySQL Shell’s dump utility is no shortcut: loading its output into MariaDB 10.11 failed with Unknown system variable 'server_uuid'. Save each application user’s grants while MySQL still runs:

sudo mysql -N -e "SHOW GRANTS FOR 'wp_app'@'localhost'; SHOW GRANTS FOR 'wp_app'@'127.0.0.1'" > grants.sql

Unknown collation utf8mb4_0900_ai_ci: the map that keeps MySQL’s behavior

MariaDB 10.11 does not recognize MySQL 8.0’s collation names, so an unmodified dump stops at its first CREATE DATABASE line. You rename them in the dump file. The replacement you pick decides which values count as equal, and a unique index (the rule that no two rows hold the same value) enforces exactly that.

$ mariadb < wpsite-mysql80.sql
ERROR 1273 (HY000) at line 22: Unknown collation: 'utf8mb4_0900_ai_ci'

Six comparisons were run on MySQL 8.0.46 and on MariaDB 10.11.14 with each candidate: two different emoji, a trailing space, ß against ss, an accent, Ł against L, and Œ against OE. MySQL’s baseline comes first (1 means equal):

emoji_eq 0 | pad_eq 0 | sz_eq 1 | accent_eq 1 | l_stroke_eq 1 | oe_eq 1

| collation                   | emoji_eq | pad_eq | sz_eq | accent_eq | l_stroke_eq | oe_eq |
| utf8mb4_general_ci          |        1 |      1 |     0 |         1 |           0 |     0 |
| utf8mb4_unicode_ci          |        1 |      1 |     1 |         1 |           0 |     1 |
| utf8mb4_unicode_520_ci      |        0 |      1 |     1 |         1 |           1 |     1 |
| utf8mb4_uca1400_ai_ci       |        0 |      1 |     1 |         1 |           1 |     1 |
| utf8mb4_uca1400_nopad_ai_ci |        0 |      0 |     1 |         1 |           1 |     1 |

Only utf8mb4_uca1400_nopad_ai_ci matched on all six. MySQL’s 0900 collations are NO PAD, meaning 'news' and 'news ' are different values. The other candidates ignore trailing spaces, and unicode_ci also treats different emoji as equal. A tag table with a unique name then refuses rows MySQL accepted. The dump turns off unique checks, so MariaDB reports this only at commit, naming no key:

ERROR 1180 (HY000) at line 231: Got error 1 "Operation not permitted" during COMMIT

Replaying the INSERT with SET UNIQUE_CHECKS=1 shows the cause, ERROR 1062 (23000) at line 1: Duplicate entry 'news ' for key 'name_u', for unicode_ci, unicode_520_ci and uca1400_ai_ci alike. The nopad target loaded all 18 rows. Sort order matched too: tag names and all 3,001 post titles came out in MySQL’s sequence, while unicode_ci moved the emoji to the end and reordered the titles.

The sed map

Save this as fix-collations.sed. It maps every 0900 name. The common one-liner renames only ai_ci; it left a utf8mb4_0900_as_cs column behind and stopped with six tables created:

ERROR 1273 (HY000) at line 216: Unknown collation: 'utf8mb4_0900_as_cs'
/^INSERT INTO /b
# MySQL 8.0 -> MariaDB 10.11 collation map (closest behaviour: UCA, accent/case-insensitive, NO PAD)
s/utf8mb4_0900_ai_ci/utf8mb4_uca1400_nopad_ai_ci/g
s/utf8mb4_0900_as_ci/utf8mb4_uca1400_nopad_as_ci/g
s/utf8mb4_0900_as_cs/utf8mb4_uca1400_nopad_as_cs/g
s/utf8mb4_0900_bin/utf8mb4_nopad_bin/g

The first line skips data lines, so a post quoting the error keeps its text:

## naive sed (every line, as in most guides)
Fixing utf8mb4_uca1400_nopad_ai_ci on import
Unknown collation: utf8mb4_uca1400_nopad_ai_ci
## safe sed (skips INSERT data lines)
Fixing utf8mb4_0900_ai_ci on import
Unknown collation: utf8mb4_0900_ai_ci
## remaining 0900 outside INSERT lines: 0

The last line differs from the lab’s file, which sent utf8mb4_0900_bin to utf8mb4_bin. In a separate check on the same 10.11.14 build, outside the main lab run, utf8mb4_bin treated 'news' and 'news ' as equal and utf8mb4_nopad_bin kept them apart. MariaDB’s alias fix MDEV-36361 uses the nopad target. Run the map, then confirm no 0900 name is left outside data lines:

sed -f fix-collations.sed wpsite-mysql80.sql > wpsite-mariadb.sql
grep -v '^INSERT INTO ' wpsite-mariadb.sql | grep -c 0900

Do not convert to the 3-byte utf8 charset, an older fix that still ranks. It replaced emoji with ? in 600 post titles and printed only warnings, because the dump’s SQL mode disables strict checks.

MariaDB 11.4.5 and later accept the 0900 names as aliases for their uca1400 collations (MDEV-20912), so on 11.8 or 12.3 the map may be unnecessary (docs only; not run here).

Switch the packages: what apt does to /var/lib/mysql

Stop MySQL and copy /var/lib/mysql before running apt. The MySQL and MariaDB packages conflict, so installing one removes the other, and the MariaDB package does not convert your data. It moves the old data directory aside and creates an empty one. Your own cold copy is the rollback you control.

sudo systemctl stop mysql
sudo cp -a /var/lib/mysql /var/lib/mysql-80-cold
sudo cp -a /etc/mysql /etc/mysql-80-cold
sudo apt install mariadb-server

The lab started servers by hand, so this guide’s systemctl lines use Ubuntu’s standard unit names but were not run. Copying the lab’s whole data directory, 790 MB including InnoDB’s own files, took 0.8 to 1.7 s with a warm page cache. The install removed mysql-server-8.0 and its client packages, pointed /etc/mysql/my.cnf at mariadb.cnf and printed this:

/var/lib/mysql: found previous version 8.0
[...] previous data directory will be renamed to /var/lib/mysql-8.0 and a new data directory will be initialized at /var/lib/mysql.
/etc/mysql: debian.cnf-8.0, debian.cnf-previous

That run had the debian-5.7.flag file Ubuntu’s MySQL package writes; without it, the directory became /var/lib/mysql-previous. Either way the data sits untouched. MariaDB cannot start on those files, since MySQL 8.0 keeps its redo log elsewhere:

[ERROR] InnoDB: File ./ib_logfile0 was not found
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

Check the new server with sudo mariadb -e "SELECT VERSION(), @@collation_server, @@event_scheduler, @@max_allowed_packet". The lab got 10.11.14, utf8mb4_general_ci, OFF and 16777216; root logs in through the Unix socket.

Troubleshooting: after one lab run with apt install --reinstall, MariaDB failed with the same ib_logfile0 error. mariadb-install-db --user=mysql --datadir=/var/lib/mysql rebuilt the directory but added anonymous accounts (''@localhost) to drop.

caching_sha2_password on MariaDB: recreate the users first

MySQL 8.0 stores passwords with caching_sha2_password, a login method MariaDB 10.11 does not have. The hashes cannot be carried over, so each app user gets a new password. Create users before the import, because DEFINER objects fail until their account exists. Both forms of the original statement failed on 10.11.14:

CREATE USER ... IDENTIFIED WITH caching_sha2_password           -> ERROR 1524 (HY000) at line 1: Plugin 'caching_sha2_password' is not loaded
(print_identified_with_as_hex=ON output)  ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; [...]

Create the accounts with a new password, then run the saved GRANT lines, which ran unchanged in the lab:

sudo mariadb -e "CREATE USER 'wp_app'@'localhost' IDENTIFIED BY 'NEW-PASSWORD-HERE'"
sudo mariadb -e "CREATE USER 'wp_app'@'127.0.0.1' IDENTIFIED BY 'NEW-PASSWORD-HERE'"
sed 's/$/;/' grants.sql | sudo mariadb

The lab’s app users had database-level grants only. If grants.sql lists MySQL-only dynamic privileges (SYSTEM_USER, for example) or role grants, they may not apply unchanged on MariaDB; review those lines first.

Both accounts got mysql_native_password; keep it for PHP. The ed25519 plugin worked from the mariadb client, but PHP 8.3’s mysqlnd driver failed:

MariaDB 10.11 (ed25519), socket, PHP mysqlnd:  FAIL 2054: The server requested authentication method unknown to the client [client_ed25519]

If you import before the users exist, nothing complains until the view, procedure or trigger runs:

ERROR 1449 (HY000) at line 1: The user specified as a definer ('wp_app'@'localhost') does not exist

Account matching changed too. A connection to 127.0.0.1 matched wp_app@127.0.0.1 on MySQL and wp_app@localhost on MariaDB, with that account’s broader grants, until skip-name-resolve was set. The cutover step checks this for each connection path. MariaDB 11.4.9, 11.8.4 and 12.1 add a caching_sha2_password plugin that keeps old passwords; its docs say it “should be only used for migration”.

Import the dump into MariaDB 10.11

With the collations renamed and the users in place, the import is one command. Raise the packet limit first if any row is larger than 16 MB, because MariaDB’s default is a quarter of MySQL’s. A 20 MB row failed like this:

ERROR 2006 (HY000) at line 46: Server has gone away
[Warning] Aborted connection 12 to db: 'pkt' user: 'root' host: 'localhost' (Got a packet bigger than 'max_allowed_packet' bytes)
sudo mariadb -e "SET GLOBAL max_allowed_packet=67108864"
sudo mariadb --show-warnings < wpsite-mariadb.sql
Warning (Code 1105): Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.

67108864 bytes is MySQL 8.0’s default. The warning is expected; the settings section turns events back on. For the 290 MB database (750,352 rows), the import took 13.7 to 28.6 s, and dump, sed and import together 16 to 31 s. mariadb-upgrade is not needed; it reported the installation as already upgraded.

Verify the import: counts, a content hash, and the CHECKSUM TABLE trap

Run the same scripts on MariaDB and compare with the files you captured before the dump:

./verify-counts.sh "sudo mariadb" wpsite > counts-mariadb.txt
sudo mariadb --show-warnings wpsite < verify-content.sql > fp-mariadb.txt
diff counts-mysql80.txt counts-mariadb.txt && diff fp-mysql80.txt fp-mariadb.txt && echo identical
identical

That single word is all the command prints when both diffs are empty. In the lab run, the per-table summary behind it was: counts equal for all seven tables (3001 posts, 12000 postmeta rows, 302 options and four smaller tables) and the content hash matched on every table. That hash left the JSON column of wp_options out; a second test run with the JSON column wrapped in HEX() matched as well.

A literal compare of SHOW GRANTS with grants.sql will still differ: MariaDB prints the account with IDENTIFIED BY PASSWORD '*...', the new password hash. That difference is expected; compare the privileges, not the whole line.

Matching counts and hashes confirm agreement for the tables and columns your checks include, so complete the pattern for every table. A Warning 1260 line in either file voids the result. Use exact counts: the TABLE_ROWS estimate in information_schema showed 598,417 on MySQL and 597,184 on MariaDB for a 600,000-row table.

CHECKSUM TABLE looks quicker, and for ordinary tables it matched even after the collation change. Two tables differed with identical data:

table          MySQL 8.0.46   MariaDB 10.11.14
wp_posts       1137959226     2842266918   DIFF
wp_postmeta    2261373369     2261373369
wp_terms       1730540776     1730540776   (same although the collation changed from 0900_ai_ci/0900_as_cs to uca1400_nopad)
wp_options     1303318842     1029886078   DIFF

Scratch tables built column by column found the cause. A VIRTUAL generated column (computed on read) changed the checksum, and a JSON column can change it too: MySQL stores JSON as binary, MariaDB as LONGTEXT with a json_valid() check. For such tables, trust the count plus the content hash.

One error may surface only once the app runs. Joining a utf8mb4_unicode_520_ci plugin table to a converted table gives ERROR 1267 (HY000): Illegal mix of collations. MySQL 8.0 gave the same error for the same join, so the mix predates MariaDB. Converting the plugin table fixed it:

ALTER TABLE wp_plugin_redirects CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_nopad_ai_ci;

Settings that change silently after the switch

Some MySQL defaults do not carry over, and MariaDB does not warn about them. Put the values you rely on in a file of your own so a package update does not overwrite them.

  • The event scheduler goes from ON to OFF. Imported events show ENABLED but never run.
  • max_allowed_packet drops from 64 MB to 16 MB.
  • The server collation for new databases comes from 50-server.cnf: utf8mb4_general_ci, which in the matrix above matched MySQL on only one of six tests.
  • skip-name-resolve is commented out, which is what moved the 127.0.0.1 login to the localhost account.
sudo tee /etc/mysql/mariadb.conf.d/60-migrated.cnf >/dev/null <<'EOF'
[mysqld]
collation-server   = utf8mb4_uca1400_nopad_ai_ci
event_scheduler    = ON
max_allowed_packet = 64M
skip-name-resolve
EOF
sudo systemctl restart mariadb

This file was not part of the main lab run. A later check on 10.11.14 confirmed its first three settings; skip-name-resolve was tested only as a startup flag. The 60 file loads after 50 and overrides it. Accounts must now use IP addresses or localhost. The package keeps bind-address = 127.0.0.1; leave port 3306 closed to the outside, as in our first-30-minutes hardening guide for Ubuntu 24.04.

Cut over: check the app’s logins, then reopen writes

Writes are still stopped, so check now; anything written after you reopen exists only in MariaDB. First put the new password in wp-config.php:

define( 'DB_PASSWORD', 'NEW-PASSWORD-HERE' );

Then log in as the app user over TCP and the socket, and compare account and grants with grants.sql (not run in the lab, which checked through PHP):

mariadb -h 127.0.0.1 -u wp_app -p -e "SELECT USER(), CURRENT_USER(); SHOW GRANTS"
mariadb -u wp_app -p -e "SELECT USER(), CURRENT_USER(); SHOW GRANTS"

With skip-name-resolve active, the TCP login should report wp_app@127.0.0.1 and the socket login wp_app@localhost. In the lab, PHP 8.3 mysqli connected both ways with no socket path change, since /var/run links to /run. Reopen writes with the command matching how you stopped them (not run in the lab), then load pages, log in and save a draft:

sudo -u www-data wp maintenance-mode deactivate --path=/var/www/example.com
sudo systemctl start php8.3-fpm

Roll back to MySQL 8.0 from the cold copy

If verification fails or the app misbehaves, go back to the copy taken before the switch. The copy lacks every write made after it, so roll back before you reopen writes, or accept losing them. Reinstalling MySQL alone is not enough.

In the lab, MySQL installed over MariaDB failed to start. Removing MariaDB without purging left its plugin config in /etc/mysql/mariadb.conf.d, and my.cnf still pointed at mariadb.cnf:

[ERROR] [MY-000067] [Server] unknown variable 'provider_bzip2=force_plus_permanent'.
[ERROR] [MY-010119] [Server] Aborting
sudo systemctl stop mariadb
sudo apt install mysql-server
sudo apt purge 'mariadb-plugin-provider-*'
sudo update-alternatives --set my.cnf /etc/mysql/mysql.cnf
sudo systemctl stop mysql
sudo mv /var/lib/mysql /var/lib/mysql-failed
sudo cp -a /var/lib/mysql-80-cold /var/lib/mysql
sudo systemctl start mysql

Restoring the copy took 0.61 s. MySQL 8.0.46 came back with all 3,001 posts and utf8mb4_0900_ai_ci as the database default. The restored user table holds the app user’s old password, so put the old value back in DB_PASSWORD. Before the update-alternatives fix, MySQL also read utf8mb4_general_ci from MariaDB’s config, so check @@collation_server.

The other path: upgrade MySQL 8.0 to 8.4

Staying with MySQL means 8.4 LTS, supported until April 30, 2032. Oracle supports an in-place upgrade from 8.0, with no dump or collation map. This section is from Oracle’s documentation, not the lab.

On Ubuntu, the simplest route to 8.4 is the release upgrade, because 26.04 ships it. Our notes on the 24.04 to 26.04 release upgrade cover that jump; on 24.04, Oracle’s apt repository provides 8.4. Check three things first, all listed in What Is New in MySQL 8.4:

  1. mysql_native_password is no longer enabled by default. Accounts on that plugin are refused at login; turn the plugin back on in the [mysqld] section (mysql_native_password=ON) or switch those accounts to caching_sha2_password.
  2. default_authentication_plugin is removed; a config file that sets it stops the server. Use authentication_policy.
  3. expire_logs_days is removed in favor of binlog_expire_logs_seconds.

Take the same cold copy of /var/lib/mysql first; it is your only way back to 8.0.

What this means for you

You do not have to move today: Ubuntu still patches MySQL 8.0 on 24.04. The smallest useful step is the inventory queries, which run without downtime and show whether your database uses the 0900 collations and caching_sha2 accounts that make this move harder. With that list in hand you can choose MariaDB, MySQL 8.4 or the 26.04 upgrade and rehearse it on a spare server first.

Hostry Engineering

Hostry Engineering is the team behind Hostry, a hosting provider operating since 2006: KVM VPS in 18+ locations, dedicated servers in Europe and the US, cPanel hosting, domains and free DNS. Commands and configuration in these articles are checked against official documentation before publishing.

All articles by Hostry Engineering

All topics