r/webdev • • 1h 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

23 comments sorted by

14

u/AlFender74 1h ago

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

1

u/Chrono_Wolf 1h 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

5

u/phobug 1h ago

Do the staging setup on your own computer.

1

u/imploder303 55m ago edited 51m 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 31m 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

•

u/imploder303 17m ago

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

•

u/Chrono_Wolf 8m ago

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

-1

u/imploder303 1h ago

This is the way

6

u/ElCuntIngles 1h 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 1h 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.

2

u/nice-username-69 1h 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 39m 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 38m 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.

•

u/Chrono_Wolf 16m 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 32m 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.

•

u/Chrono_Wolf 18m 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/iamsharjeeltt 56m 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 49m 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.

•

u/Confident-Limit-4066 25m 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.

•

u/StarboardChaos 23m 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

0

u/codariadev 57m 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.