r/webdev • u/Chrono_Wolf • 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:
- 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.
- Since rollback is impossible, I want to be sure the backup actually restores.
- 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.
14
u/AlFender74 1h ago
Create a staging environment. Upgrade it their.. see what breaks. Fix it. Then do production site
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.
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/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.
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.
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
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:
groups,rankandwindowused as unquoted table/column names. Grep the booking plugin and your own code for those first.GROUP BY col DESCis gone. Anything relying on that order needs an explicit ORDER BY.For the backup:
mysqldump --single-transaction --routines --triggers --hex-blob --default-character-set=utf8mb4, then actually restore it into a localmysql:8.0container 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'sutil.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.