r/webdev • • 2d ago

Question Upgrading MySQL 5.7 → 8.0 on shared hosting (a live WordPress site AND my custom-coded site sharing the same DB). How do I not break the client's business?

This is my first site that I'm deploying myself (someone else always handled this before), and it's for a small business, so a failure has real consequences for the owner.

Setup:
- Shared hosting at Aruba (Italy), Percona Server 5.7.44, one MySQL service with 5 databases but only one is used (~13 MB, utf8mb4_unicode_ci, server charset latin1)
- Live site: WordPress 7.1.5, PHP 8.0.30 (will be bumped to the latest PHP at release)
- The site I'm deploying is pure custom code. It connects to the same database as the live WordPress site (but read/write a different db in the same mysql group).
- The host's panel has an "Upgrade version" button for 5.7 → 8.0. They explicitly say there is NO downgrade, and the service expires in 3 weeks.

The WP site has ~20 plugins, many outdated, including a custom booking plugin with no update channel (the core of the business), an old Slider Revolution without a license, WPBakery 7.3, Meta Box 5.9, and a currency switcher for WooCommerce.

My priorities and fears:

  1. The DB comes first. I'm afraid the upgrade will break WP settings/serialized options or custom tables, and that a 5.7 dump isn't enough of a safety net.
  2. Since rollback is impossible, I want to be sure the backup actually restores.
  3. I'm changing PHP and MySQL in the same release and want to avoid not knowing which one broke what.

Questions:
- Does an in-place 5.7 → 8.0 upgrade normally preserve everything (wp_options, serialized data, custom tables, triggers)? Which MySQL 8 differences should I check for in both WP plugins and my own code (reserved words, GROUP BY ordering, sql_mode, collation, charset)?
- What's the right mysqldump setup for this, and how do I truly validate the backup before upgrading (I have empty spare DBs on the same service)?
- With a DB shared between WP and my custom code, what's the safest order: PHP first, DB later? Staging on the same server using a copy of the DB, or locally with Docker (mysql:5.7 vs mysql:8.0)?
- Any experience with unmaintained plugins breaking on MySQL 8, and how would you test them before touching production?

Thanks, any checklist or war story is welcome.

0 Upvotes

46 comments sorted by

25

u/AlFender74 2d ago

Create a staging environment. Upgrade it their.. see what breaks. Fix it. Then do production site

3

u/omfgtora 2d ago

There*

I know it doesn't exactly matter much, but just an FYI

1

u/Chrono_Wolf 2d ago

That's what I'd normally do. My constraint is that on this host the MySQL version belongs to the DB service, not to a single database: there's one "upgrade" button for the whole service (5 DBs under one user/host) and no downgrade. So a staging DB on the same service would be upgraded together with production, and I can't have staging on 8.0 and prod on 5.7 side by side. I'm confirming with support whether it's really per-service

2

u/imploder303 2d ago edited 2d ago

Ok, I recently faced the same problem, and the headaches came from collation and deprecated things here and there, al least try to import an export to a local db and see if everything goes well.
Php with wp on the other hand should be pretty straightforward.

1

u/Chrono_Wolf 2d ago

That's exactly the kind of thing I'm worried about. I've already imported the dump into a local MySQL 8 and it works, but I'm not sure that catches everything.
Also good to know about php
And honestly, i just do not want to fuk up everything XD
I'm new on this part about programming

2

u/imploder303 2d ago

If it worked local, then you are probably good to go,. plugins probably won’t be that complex to bring trouble.

2

u/Chrono_Wolf 2d ago

I wont bother that much honestly. I'll wipe everything from the original site around the end of the year XD

13

u/phobug 2d ago

Do the staging setup on your own computer.

2

u/quietproducer 22h ago

This is the right answer. Host not having an easy environment isn't an excuse to stop. Might be an excuse to charge a bit more.

-3

u/imploder303 2d ago

This is the way

8

u/ElCuntIngles 2d ago

For me, step one would be to get it running locally on a dev box with the new versions of PHP and MySQL.

I wouldn't necessarily expect any issues with the MySQL part, more likely the php part, but obviously you have to test it, and not on production.

1

u/Chrono_Wolf 2d ago

PHP is probably the riskier part, and I can leave the PHP bump for later since my local setup runs 8.0 like the server (8.0.30).

What I'm less sure about is what's hidden behind the host: the server charset is latin1 while the DBs are utf8mb4, the DB is only reachable from inside the host's network (so I can't point my local box at it), and I can't replicate their Percona sql_mode locally.

So my plan is to move a copy of the site to a password-protected subfolder on the same hosting, pointing to a spare empty database where I restore a dump of the real one (never the live DB, since WP stores siteurl in it and my custom code writes there too). That would test everything on the real infrastructure except the MySQL version itself.

The DB is the delicate part because it holds the client's data and the upgrade is one-way.

3

u/Confident-Limit-4066 2d ago

clone both sites and the DB locally in Docker first so you can test the old plugins against MySQL 8 without risking the live business, and do one upgrade at a time.

1

u/Chrono_Wolf 2d ago

i'm gonna go with this plan indeed. But i'm not sure that, cloning the WP site, will be functional as it should. my concern is just about the db

2

u/nice-username-69 2d ago

Nothing really breaks unlike moving from PHP 7 to PHP 8.

You're on WP 7.1.5 already and your plugins didn't break.

It'll likely be a straightforward process upgrading mysql 5.7 to 8.4 and PHP 8.0 to 8.4 or 8.5

1

u/Chrono_Wolf 2d ago

To keep it focused on MySQL only (PHP stays as is for now): my host only offers 5.7 to 8.x in place, with no downgrade, so I can't try it on the live service first.

Since the plugins work today on 5.7, my main worry is a pure in-place upgrade: does anything in WP break (options, serialized data, plugins using reserved words or old GROUP BY behaviour), and does the upgraded data behave like a fresh import? I'm planning to test it locally by running 5.7, importing the dump, then starting 8.0 on the same data volume.

1

u/sepiasend_tamas 2d ago

In-place 5.7 to 8.0 normally keeps wp_options and serialized data fine, since that's just text in tables. The things that bite are the stricter SQL modes and the default auth plugin, so test your custom code and the booking plugin against a real 8.0 instance first. For the backup, restore a fresh mysqldump into a throwaway local MySQL 8.0 (Docker works) and click through the site against it. That tests both the dump and the upgrade without touching production. I'd also do the MySQL upgrade and the PHP bump as two separate releases a day or two apart, so you know which one broke something.

1

u/Chrono_Wolf 2d ago

Thanks, that's the plan. I'll restore the dump into a local 5.7, run the upgrade to 8.0 on that same data (not a fresh import), and click through the site and the booking flow. I'll match sql_mode and collation to production as closely as I can; it won't be identical to the host, but the basic upgrade rules should carry over. Will also compare row counts per table before and after. Will report back.

1

u/Choice_Wheel_2 2d ago

MySQL Shell has util.checkForServerUpgrade, which scans the 5.7 server and lists incompatibilities like old collations or reserved words. Run that against the live service, then restore the dump into Docker mysql:8.0 and compare row counts per table.

2

u/Chrono_Wolf 2d ago

Good suggestion, i forgot about that command. Worth noting that util.checkForServerUpgrade is a MySQL Shell function, not SQL, so I can't run it from phpMyAdmin, and the host only allows connections from inside its own network anyway. I'll run it against a local 5.7 loaded with the production dump instead. It should catch the schema-level issues (collations, reserved words), and I'll rehearse the full procedure there before touching the provider.

1

u/Choice_Wheel_2 2d ago

That plan works if the local 5.7 uses the host's latin1 server charset and sql_mode. SHOW VARIABLES in phpMyAdmin will give you both.

1

u/iamsharjeeltt 2d ago

Do the database upgrade first and leave PHP 8.0.30 alone until the MySQL 8.0 upgrade is proven stable, because changing both in one release means you cannot tell which one broke the booking flow. For the backup, take a mysqldump with --single-transaction --routines --triggers --events, restore it into one of those empty databases on the same Aruba service, then run mysqlcheck and actually log into a copy of the site pointed at that restored database and complete a test booking — a dump file you have never restored is not a safety net. The latin1 server charset is the trap to check first: your tables are utf8mb4_unicode_ci, so after the restore compare SHOW CREATE TABLE output and look for collation changes or garbled characters in booking data before you touch production. For the unmaintained plugins, test Slider Revolution, WPBakery 7.3 and the currency switcher on that staging copy against MySQL 8.0 specifically for GROUP BY queries and reserved words under the stricter ONLY_FULL_GROUP_BY default, and treat the custom booking plugin as the highest risk because it has no update channel and no one else will have tested it for you.

1

u/CashKeyboard 2d ago

Honestly unless you're running really bad code there's not so much that can really go wrong. I've migrated around 10 applications on that path lately and while most were issue free, the ones that weren't were tiny and fixable issues either around SQL syntax that was iffy anyway or around mismatched types of foreign keys (why would anyone do that on the first place?).

Since PHP is even bigger on BC I'd say it's the safer bet anyway so go with that first. I cannot ever remember a PHP migration going south where the project didn't have a ton of technical debt anyway.

1

u/StarboardChaos 2d ago
  1. Backup the data
  2. Allocate a cloud database version 8
  3. Restore backup
  4. Make the website use the new database
  5. Upgrade old database
  6. Switch website to old database

1

u/usestackrank 2d ago

A few MySQL 8 specifics that bit me on similar upgrades: ONLY_FULL_GROUP_BY is on by default now, so old plugin queries that select non-aggregated columns can start throwing errors. Also check custom code for newly reserved words used as column names (rank, groups, system, window, etc.), and zero dates like '0000-00-00' which strict mode rejects on insert. WP core itself is fine on 8.x, the old plugins are where it breaks.

On the backup: restoring into one of your spare DBs is the right test. After the restore, compare row counts per table against the live DB, and run CHECKSUM TABLE on the important ones (booking tables first). Then load a copy of the site against the restored DB and make a test booking.

Since PHP and MySQL are separate risks, I'd also turn on the plugins' debug log (WP_DEBUG_LOG) on the staging copy and click through every booking/admin screen, and grep the log for 'SQL syntax' errors. One more thing: 8.0 reached end of life in April 2026, so if the panel lets you pick 8.4 that's the better target.

1

u/ConcentrateLow5694 2d ago

The one thing I'd separate from the rest is the deadline pressure. With the service expiring in three weeks, I'd sort out the renewal or extension first, so the upgrade isn't happening because the clock forced it — a one-way upgrade is exactly the job you don't want to rush. For the custom booking plugin, I'd also test a full booking end to end on the restored copy, not just that WordPress loads: create, edit and cancel a booking, because that's where a broken query or changed default usually shows up. And since you flagged the latin1 server charset, after the restore I'd check that a few serialized options still load correctly and compare row counts, rather than trusting that the dump imported cleanly.

1

u/Early-Community9943 2d ago

If Aruba can give you a new 8.0 DB service next to the old one, import a dump there and point a staging copy at it. Keeps 5.7 as your rollback since that button is one-way.

1

u/IncomeOk7237 2d ago

you've got spare empty dbs, so restore your dump (--single-transaction --routines --triggers) into one and point a copy of the site at it before touching the upgrade button. otherwise you don't really know the backup restores

1

u/Ok-Gazelle5598 2d ago

Did almost exactly this for a client last year (shared host, one-way upgrade button, old plugins nobody maintains). It went fine, but only because we treated the backup as the real plan and the upgrade as the risky bit. Roughly what I'd do:

  1. Split the changes. Bump PHP first on the current 5.7 database, let it run a few days, fix what breaks. Then do MySQL. If you do both in one night and the booking plugin dies you'll have no idea which one did it.
  2. Backup you have actually restored. mysqldump with --single-transaction --routines --triggers --events --hex-blob and --default-character-set=utf8mb4. Then restore it into one of your empty spare DBs and compare row counts per table, plus spot check wp_options and the booking plugin's own tables. Also grab a full files backup of wp-content. Keep a copy off the host, since the service expires in 3 weeks anyway.
  3. You already tested the dump on local MySQL 8, which is great, but test the site too, not just the import. Docker with mysql:8.0 and your exact PHP version, point a copy of WP and your custom code at it, and click through the booking flow end to end. That's where old plugins usually blow up, not in the data.
  4. Things that actually bit me on 8.0: ONLY_FULL_GROUP_BY in sql_mode breaking old GROUP BY queries, zero dates (0000-00-00) being rejected under strict mode, new reserved words like rank, groups or system used as column names, and the default collation changing to utf8mb4_0900_ai_ci. Serialized data in wp_options survives fine, it's just text, as long as the charset doesn't get mangled. Your server charset being latin1 is the one I'd look at hardest, check the dump really comes out as utf8mb4.
  5. If the old booking plugin chokes on sql_mode, you can often set a more relaxed sql_mode just for that connection in wp-config or your own code instead of touching the server. Ugly but it buys you time.

And do it on a quiet day with the owner warned, not Friday evening. Ask me how I know.

1

u/Thin-Read-4483 2d ago

Since there's no downgrade path and an unmaintained booking plugin is on the line, don't do PHP + MySQL at once

1

u/cajunjoel 2d ago

I've been through this, but you NEED a copy of the current environment to test everything you can. Don't do this to a production site.

Get a VM on your computer, install something like Debian, track down the versions of the database, PHP, and all the same versions of wordpress plugins and everything. Make the site run on your dev environment. (And sanitize any sensitive or personal data, like email addresses and names and phone numbers, if you want to really be safe)

Make a snapshot of the VM, then start upgrading.

This is the only correct process when a business is on the line. You will find surprises. A plugin may not work, or may not have an upgraded version. You may need to throw out some plugins because they are unsupported. it's better to find and fix problem in a testing environment than in production.

1

u/[deleted] 2d ago

In-place 5.7 to 8.0 usually carries wp_options, serialized data and custom tables over fine, since serialized strings do not care about the version; what bites people is code that leans on MySQL's old loose GROUP BY handling, and table or column names that became reserved words in 8.0.

Treat the dump as your only real safety net and prove it before touching anything: mysqldump with --single-transaction, --routines, --triggers and utf8mb4, restored into one of your spare databases, with a copy of each site pointed at that restore.

Change PHP and MySQL one at a time rather than in the same release, otherwise if the booking plugin misbehaves you will not know which change did it. Staging on the same host with the restored database gets you closer to reality than Docker, since it keeps the host's PHP build, extensions and limits, and switching on general logging for one click-through of the booking flow is the fastest way to catch queries that MySQL 8 rejects.

Existing utf8mb4_unicode_ci tables keep working under 8.0, so I would leave collations out of that release and move them later only if you actually want the new default. And because there is no downgrade, take one more dump minutes before the upgrade and keep the file somewhere off the hosting account, so the worst case costs you an afternoon instead of the owner's bookings.

1

u/Particular-Rock6086 2d ago

I’d avoid changing PHP and MySQL in the same release. First make a full backup and restore it into one of your spare databases; verify the restored tables, triggers, and a few critical WordPress flows, especially the booking workflow. Then test the copied site against MySQL 8 with the current PHP version, and change one variable at a time.

A dump is useful only if you’ve confirmed you can restore it. Also check the host’s exact MySQL 8 settings and whether they can provide a staging copy or help with recovery, since there’s no downgrade path.

Given the unmaintained booking plugin and the business impact, I’d get the owner’s approval for a maintenance window and a tested recovery plan before upgrading. I'm from Greenice, and if you want, we can help you with updating.

1

u/davidbalbino 2d ago

tbh restoring the dump on a local 8.0 already covers most of it. what I'd add: load the same dump in a local mysql:5.7 container and run mysqlsh -- util checkForServerUpgrade against it, it flags reserved words (rank, groups...), zero dates, old auth stuff etc before you press the button.

the gotcha I think is more sneaky is that GROUP BY don't sort implicitly anymore in 8.0, so any query (yours or the booking plugin) that relied on it without ORDER BY just comes back in other order, no error. worth a grep.

for the backup something like mysqldump --single-transaction --routines --triggers --hex-blob --default-character-set=utf8mb4 dbname > dump.sql, restore it in one of the spare DBs and compare row counts + CHECKSUM TABLE with the original. and yeah keep PHP for a later release, one change at a time

1

u/Psychological_Read_1 1d ago

Don't do it live first. Clone the site locally with the same MySQL 8.0 version, run the upgrade there, and check the unmaintained plugins one by one. The breaking changes are usually in queries and character sets, and you'll find them in minutes locally. Also take a full backup before you touch the live database, and keep the old version restorable until you've run the site on 8.0 for a few days.

1

u/anoncaatyee 1d ago

changing php and mysql in the same release is the one thing worth restructuring, not because it can't work, but because you lose the ability to bisect when something breaks. the staged version: dump the db, restore it into a fresh 8.0 instance anywhere (a local container works) and point copies of both sites at it. that single rehearsal answers 'does the backup restore' and 'does 8.0 break the plugins' before the irreversible button. then php first on the live site, watch for a day, then mysql. the booking plugin with no update channel is the real risk, not wordpress core, so it deserves its own test in the rehearsal.

0

u/codariadev 2d ago

The in-place upgrade doesn't rewrite your data, so wp_options, serialized values and custom tables come through as they are. Serialized data only breaks when something changes the bytes (a charset conversion or a naive search-replace), not from a version bump.

What actually bites on 5.7 → 8.0 is SQL that used to be accepted:

  • new reserved words like groups, rank and window used as unquoted table/column names. Grep the booking plugin and your own code for those first.
  • GROUP BY no longer sorts implicitly, and GROUP BY col DESC is gone. Anything relying on that order needs an explicit ORDER BY.
  • new tables default to utf8mb4_0900_ai_ci while yours are utf8mb4_unicode_ci. If your code creates tables without an explicit COLLATE and joins them with old ones, you get "Illegal mix of collations".
  • NO_AUTO_CREATE_USER doesn't exist anymore, so code that sets sql_mode with it will error.

For the backup: mysqldump --single-transaction --routines --triggers --hex-blob --default-character-set=utf8mb4, then actually restore it into a local mysql:8.0 container and run WP plus your code against it on the target PHP. That's your staging and your backup test in one go. If the host allows remote connections, MySQL Shell's util.checkForServerUpgrade() against the live 5.7 flags most of this for you.

Do PHP first, let it run a few days, then MySQL. Also worth asking Aruba about 8.4, since 8.0 went EOL in April 2026.