From MySQL 8.0 to MariaDB 11.8 LTS: The Bagisto Experience

The Bagisto team are back!
After sharing their experience using our MariaDB Vector for semantic search in their e-commerce platform Bagisto, the open-source platform built on Laravel, the Bagisto team is now focusing on another topic that is close to our hearts at the MariaDB Foundation: migrating from MySQL to MariaDB.
How much effort is it to move an existing app from MySQL 8.0 to MariaDB 11.8 LTS? Are any application code changes required? What about compatibility and performance?
Rather than answering those questions in theory, the Bagisto team migrated using a representative e-commerce dataset and documented the whole process, including what worked, what didn’t, and what they learned.
I’ll have the Bagisto team go through their experience.
A Bagisto + MariaDB use case: what the migration involved, what we measured, and what we would do differently
At a Glance
| Item | Result |
|---|---|
| Application | Bagisto 2.4.10 on Laravel 12.62.0, PHP 8.3.33 |
| Source database | MySQL 8.0.46 |
| Target database | MariaDB 11.8.9 (LTS) |
| Data moved | 147 tables, 157,697 rows, 47.9 MB |
| Store contents | 2,568 products, 2,967 customers, 10,000 orders, 6,008 invoices |
| SQL dump | 28.5 MB, exported in 2.6 seconds |
| Import into MariaDB | 6.7 seconds, zero errors |
| Row-count check | 147 of 147 tables identical |
| Schema check | Tables, columns, indexes, and foreign keys identical in number |
| Application code changes | None |
| Configuration changes | Database block of .env only |
Summary
The data moved cleanly. A single mysqldump export and mariadb import copied all 157,697 rows in 9.3 seconds of transfer time, with no errors and no edits to the dump.
Bagisto started on MariaDB with one .env change. All 196 migrations were recognised, and every benchmark request to ten storefront and admin endpoints returned HTTP 200.
With both servers configured identically, most pages performed within about 10% of each other, and write workloads were effectively equal. Two endpoints changed noticeably because of query-plan differences, one faster and one slower on MariaDB.
The Store
The store is a standard Bagisto 2.4.10 installation, the release that added MariaDB to Bagisto’s installer. It started from the Bagisto demo catalogue, which was then extended with Bagisto’s data generator and model factories to give the database a realistic mix of catalogue, customer, and sales data.
| Data | Rows |
|---|---|
| Products | 2,568 |
| Product attribute values | 60,964 |
| Categories | 41 |
| Customers | 2,967 |
| Orders | 10,000 |
| Order items | 19,948 |
| Order addresses | 20,000 |
| Invoices | 6,008 |
| All 147 tables | 157,697 |
The MySQL Setup
| Item | Detail |
|---|---|
| Server | MySQL 8.0.46, Ubuntu 22.04 package |
| Database default collation | utf8mb4_0900_ai_ci, the MySQL 8 default |
| Storage engine | InnoDB for all 147 tables |
| Size | 47.9 MB (30.6 MB data, 17.3 MB indexes) |
| Binary log | On, with sync_binlog = 1 |
| InnoDB buffer pool | 128 MB (default) |
Migration Approach
MariaDB cannot open a MySQL 8 data directory directly. The migration therefore used a logical SQL dump created with MySQL’s mysqldump and imported with MariaDB’s client. The application files and uploaded media remained in place; the database connection was switched only after the data had been imported and validated.
Step 1: Check the Current Bagisto and MySQL Setup
Before changing anything, record the Bagisto version, MySQL version, migration status, database size, and any MySQL 8-specific collations. This establishes a baseline and identifies compatibility issues before the migration.
Run these commands from the Bagisto project root. Replace the database host and username with the values used by the current store:
$ php artisan bagisto:version
$ mysql -h 127.0.0.1 -u bagisto_user -p -e "SELECT VERSION(), @collation_server;"
$ php artisan migrate:status
These queries report the database size and identify columns using MySQL 8’s 0900 collations. The migration test returned no 0900-collated Bagisto columns:
SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS size_mb
FROM information_schema.tables
WHERE table_schema = 'bagisto';
SELECT table_name, column_name, collation_name
FROM information_schema.columns
WHERE table_schema = 'bagisto'
AND collation_name LIKE '%0900%';
Step 2: Prepare the MariaDB Server
MariaDB should be prepared before the maintenance window begins. The target database should use utf8mb4 and the collation expected by the Bagisto installation.
Create an empty target database and a dedicated application user. Replace the database name, username, host, and password with the production values:
CREATE DATABASE bagisto CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bagisto_user'@'localhost' IDENTIFIED BY 'Use-A-Strong-Password';
GRANT ALL PRIVILEGES ON bagisto.* TO 'bagisto_user'@'localhost';
The target MariaDB server used in this migration was MariaDB 11.8.9. The old MySQL database was kept available as a rollback option.
Step 3: Back Up the Bagisto Application and Storage
Before touching the database, preserve the Bagisto environment configuration and uploaded media. The .env file contains the current database connection, while storage/app contains application uploads such as product and category media.
Run these commands from the Bagisto root directory. Keep copies of both backup files outside the production server as an additional recovery measure:
$ cp .env .env.mysql-backup
$ tar -czf bagisto-storage-backup.tar.gz storage/app
The application source code, themes, packages, and custom code should also be backed up or confirmed in version control before the migration.
Step 4: Put the Store Into Maintenance Mode
The store must stop receiving writes before the final database export. Otherwise, new orders, customer registrations, cart changes, or other database updates could occur after the export and be missing from MariaDB.
This enables Laravel maintenance mode. The secret token can be used to access the store for testing while normal visitors see the maintenance page:
$ php artisan down --secret="replace-with-a-long-random-token"
The maintenance window should cover the final export, import, configuration change, validation, and the decision to bring the store back online.
Step 5: Record Key Row Counts and Export MySQL
Before exporting, record counts for important Bagisto tables. These counts provide a quick validation after the import.
This saves baseline row counts to counts-before.txt. Replace the host, username, database name, and table names if the store uses different values or a table prefix:
$ mysql -h 127.0.0.1 -u bagisto_user -p -N bagisto -e "SELECT 'products', COUNT(*) FROM products UNION ALL SELECT 'customers', COUNT(*) FROM customers UNION ALL SELECT 'orders', COUNT(*) FROM orders UNION ALL SELECT 'invoices', COUNT(*) FROM invoices UNION ALL SELECT 'cart', COUNT(*) FROM cart;" > counts-before.txt
This creates the logical SQL backup used for the migration. The migration produced a 28.5 MB dump in 2.6 seconds:
$ mysqldump -h 127.0.0.1 -u bagisto_user -p \
--single-transaction \
--routines \
--triggers \
--hex-blob \
--no-tablespaces \
--set-gtid-purged=OFF \
--default-character-set=utf8mb4 \
bagisto > bagisto-mysql.sql
The important options preserve a consistent InnoDB snapshot, include routines and triggers, handle binary values safely, avoid tablespace privilege issues, keep GTID statements out of the dump, and preserve UTF-8 data.
Step 6: Check the Dump for MySQL 8 Collations
This counts MySQL 8 0900 collation references in the dump. The migration returned 0, so the dump required no rewrite:
$ grep -c "utf8mb4_0900" bagisto-mysql.sql
If a dump contains 0900 collations and the target MariaDB version does not support them, replace the affected collation with the collation used by the Bagisto database before importing.
Step 7: Import the Database Into MariaDB
With the target database empty and the MySQL export validated, load the dump using the MariaDB client.
This executes the SQL dump against the MariaDB database. A successful import returns to the shell without errors. In the migration documented here, the import took 6.7 seconds and returned exit code 0:
$ mariadb -h 127.0.0.1 -u bagisto_user -p --default-character-set=utf8mb4 bagisto < bagisto-mysql.sql
If an import fails, do not continue with a partially imported database. Identify the error, recreate the empty target database, and repeat the import after resolving the issue.
Step 8: Refresh MariaDB Table Statistics
This runs ANALYZE TABLE across the database so MariaDB has current optimizer statistics after the import. In this migration, all 147 tables reported OK in 0.3 seconds:
$ mariadb-check -u bagisto_user -p --analyze --databases bagisto
This step was added after the first benchmark round. The initial MariaDB benchmark exposed a slow query plan that improved dramatically after table statistics were refreshed.
Step 9: Point Bagisto to MariaDB
Once the database has been imported and checked, update only the database connection block in .env. Application files and uploaded storage remain unchanged.
Replace the connection values with the actual MariaDB server details. Keep DB_PREFIX exactly as it was before the migration:
DB_CONNECTION=mariadb
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=bagisto
DB_USERNAME=bagisto_user
DB_PASSWORD=Use-A-Strong-Password
DB_PREFIX=
Clear Laravel’s cached configuration so the application reads the new database settings. Rebuild the configuration cache if production uses cached configuration:
$ php artisan optimize:clear
$ php artisan config:cache
Step 10: Verify the Database and Bagisto
These commands confirm that Bagisto is connected to MariaDB and that the existing migration history is intact. The migration reported MariaDB 11.8.9 and 196 migrations ran with 0 pending:
$ php artisan db:show
$ php artisan migrate:status
This repeats the baseline row-count check against MariaDB. No output from diff means the compared counts match:
$ mariadb -h 127.0.0.1 -u bagisto_user -p -N bagisto -e "SELECT 'products', COUNT(*) FROM products UNION ALL SELECT 'customers', COUNT(*) FROM customers UNION ALL SELECT 'orders', COUNT(*) FROM orders UNION ALL SELECT 'invoices', COUNT(*) FROM invoices UNION ALL SELECT 'cart', COUNT(*) FROM cart;" > counts-after.txt
$ diff counts-before.txt counts-after.txt
For a stronger validation, the migration compared all 147 tables. Every table matched, for a total of 157,697 rows. Tables, columns, indexes, and foreign keys also matched in number.
Step 11: Test the Store Before Going Live
Use the maintenance-mode bypass URL to test the storefront and admin panel before reopening the store.
Check the home page, categories, products, search, customer login, cart, checkout, orders, invoices, and admin grids.
Review storage/logs for SQLSTATE, QueryException, or other database errors. Also test any installed extensions that issue custom database queries.
Rebuild Bagisto indexes if product prices, inventory, or listing data require reindexing after the migration:
$ php artisan indexer:index --mode=full
Step 12: Bring the Store Back Online
The first command ends maintenance mode. The second signals long-running queue workers to restart so they load the new database configuration:
$ php artisan up
$ php artisan queue:restart
After reopening the store, place a test order and monitor the application logs. Continue watching the store closely during the first production period after the migration.
Step 13: Keep a Rollback Path
Do not immediately delete the original MySQL database. Keep it untouched until the MariaDB environment has been verified in production.
These commands restore the previous application configuration and restart queue workers. A rollback after new orders have been created requires a separate plan to preserve data written to MariaDB after the migration:
$ cp .env.mysql-backup .env
$ php artisan optimize:clear
$ php artisan queue:restart
Validation Results
Data Validation
All 147 tables were compared between MySQL and MariaDB. Every table matched, with 157,697 rows transferred.
| Table | MySQL | MariaDB |
|---|---|---|
| products | 2,568 | 2,568 |
| product_attribute_values | 60,964 | 60,964 |
| customers | 2,967 | 2,967 |
| orders | 10,000 | 10,000 |
| order_items | 19,948 | 19,948 |
Schema Validation
| Object | MySQL | MariaDB |
|---|---|---|
| Tables | 147 | 147 |
| Columns | 1,384 | 1,384 |
| Indexes | 360 | 360 |
| Foreign keys | 186 | 186 |
Performance Observations
How the Engines Were Compared
| Setting | MySQL | MariaDB |
|---|---|---|
| Version | 8.0.46 (official mysql:8.0.46 Docker image) | 11.8.9 (official mariadb:11.8 Docker image) |
| Container limits | 4 CPUs, 1.5 GB RAM | 4 CPUs, 1.5 GB RAM |
| innodb_buffer_pool_size | 128 MB | 128 MB |
| innodb_flush_log_at_trx_commit | 1 | 1 |
| innodb_flush_method | O_DIRECT | O_DIRECT |
| Redo log size | 128 MB | 128 MB |
| Binary log (main runs) | Off | Off |
| Binary log (durability runs) | On, sync_binlog = 1 | On, sync_binlog = 1 |
Only one database container ran at a time. Before each run, the container was created fresh, the same dump was imported, and ANALYZE TABLE was run on all 147 tables. Row counts were confirmed identical to the source before any test started.
All other server settings were left at each engine’s defaults. The notable default differences are that performance_schema and the InnoDB adaptive hash index are on in MySQL 8.0 and off in MariaDB 11.8.
The benchmark copy of the store contains 10,600 orders and 161,661 rows in total. It is the migrated store plus the orders written during the first benchmark round.
Read Performance: Database Time per Request
Each endpoint was requested 64 times through Bagisto’s HTTP kernel, 4 warm-up requests followed by 60 measured ones. Every request ran in a freshly booted application with an empty application cache, so every request reached the database.
The figures are the total time spent in SQL queries per request. All 1,280 requests returned HTTP 200. The storefront search API and category listing API returned identical products on both engines.
| Endpoint | Queries | MySQL median | MariaDB median | Change |
|---|---|---|---|---|
| Storefront home page | 43 | 26.4 ms | 23.7 ms | −10% |
| Storefront category page | 44 | 25.6 ms | 23.8 ms | −7% |
| Storefront product page | 71 | 45.1 ms | 46.4 ms | +3% |
| Category product listing API | 26 | 47.2 ms | 251.2 ms | +432% |
| Storefront search API | 30 | 239.0 ms | 33.7 ms | −86% |
| Admin orders grid | 80 | 153.8 ms | 135.5 ms | −12% |
| Admin customers grid | 17 | 47.9 ms | 43.2 ms | −10% |
| Admin products grid | 6 | 12.0 ms | 18.6 ms | +55% |
| Admin dashboard overall stats | 12 | 52.2 ms | 37.6 ms | −28% |
| Admin dashboard top products | 3 | 59.3 ms | 93.0 ms | +57% |
Most endpoints are within about 10% of each other. The large differences come from individual queries receiving different execution plans on the two engines, in both directions. They are not a general speed difference between the servers.
Write Performance
Both write workloads run through Bagisto’s own code:
$ php artisan indexer:index --mode=full
for the reindex, and the storefront checkout services for orders (add to cart, save addresses, collect shipping rates, save payment, create order).
Each workload was run twice per engine. The table shows total elapsed time and the time spent inside the database. Most of the elapsed time is PHP work that is identical on both engines.
Binary log off on both servers:
| Workload | MySQL 8.0.46 elapsed / in database | MariaDB 11.8.9 elapsed / in database |
|---|---|---|
| Full product reindex (Run 1) | 124.3 s / 15.8 s | 110.9 s / 6.1 s |
| Full product reindex (Run 2) | 113.2 s / 7.8 s | 112.5 s / 6.6 s |
| 300 new orders (Run 1) | 156.1 s / 40.5 s | 155.1 s / 36.7 s |
| 300 new orders (Run 2) | 155.5 s / 41.9 s | 153.5 s / 38.5 s |
Binary log on with sync_binlog = 1 on both servers:
| Workload | MySQL 8.0.46 elapsed / in database | MariaDB 11.8.9 elapsed / in database |
|---|---|---|
| Full product reindex (Run 1) | 118.6 s / 12.1 s | 122.2 s / 14.5 s |
| Full product reindex (Run 2) | 128.6 s / 21.1 s | 113.9 s / 9.5 s |
| 300 new orders (Run 1) | 164.0 s / 46.3 s | 160.3 s / 42.4 s |
| 300 new orders (Run 2) | 166.0 s / 49.8 s | 164.7 s / 46.0 s |
Under identical configuration, write performance is effectively the same. Elapsed times are within a few percent of each other in every pairing.
The database time for the reindex varies by up to 2× between runs on the same engine, so neither engine has a meaningful lead there.
For orders, MariaDB spent 8–10% less time in the database in all four pairings, a small and consistent difference.
Turning on the binary log with sync_binlog = 1 added roughly 10–20% database time to order creation on both engines.\
Storage Size
The same store (147 tables, 2,568 products, 10,600 orders) was imported into a fresh MySQL 8.0.46 and a fresh MariaDB 11.8.9 with identical settings, and measured after
ANALYZE TABLE:
| Measure | MySQL 8.0.46 | MariaDB 11.8.9 | Difference |
|---|---|---|---|
| Data | 28.66 MB | 28.52 MB | −0.5% |
| Indexes | 18.63 MB | 15.72 MB | −15.6% |
| Data and indexes | 47.28 MB | 44.23 MB | −6.5% |
| Files on disk | 125.64 MB | 98.42 MB | −21.7% |
Data size was nearly identical on the two engines. Index size was 15.6% smaller on MariaDB.
Issues Found
Slow Query Plan Immediately After Import
In the first MariaDB benchmark round, the admin orders grid took 33 seconds per request. Running ANALYZE TABLE on the imported tables reduced the same query to 0.7 ms. This is why refreshing table statistics is now included as an explicit migration step.
Category Product Listing Query
The category product listing API spent 251 ms in the database on MariaDB compared with 47 ms on MySQL. The difference reproduced under identical server configuration, so it is a real query-plan difference and not a side effect of the test setup. Bagisto’s listing query joins product variants on an expression, COALESCE(variants.parent_id, variants.id) = products.id. MariaDB executes this join as a block nested-loop join, while MySQL 8.0 uses a hash join. This endpoint should therefore be measured on staging for stores with large categories.
Plans Differ in Both Directions
The same kind of plan difference worked in MariaDB’s favour elsewhere. The storefront search API took 34 ms on MariaDB and 239 ms on MySQL, while returning identical results. Measure the endpoints that matter most to a store rather than assuming a uniform speed-up or slow-down.
Lessons Learned
- Refresh table statistics immediately after importing the database.
- Compatibility was straightforward for the Bagisto core in this migration; no application code changes were required.
- The same SQL can produce different query plans on different database engines, sometimes faster and sometimes slower.
- Validate the migration with row counts and schema checks instead of relying only on a successful import.
- Keep the old MySQL database and the .env backup until the production migration is proven stable.
- Test extensions and custom SQL separately because database-specific queries can behave differently.
- Compare engines only under identical conditions: the same resources, buffer pool, flush settings, and binary log configuration. A mismatch, such as the binary log being on for one server and off for the other, can produce differences that look like a performance result but are not.
Test Environment
| Item | Detail |
|---|---|
| Machine | Intel Core i5-8400 (6 cores, 6 threads), 7.5 GB RAM, SATA SSD |
| Operating system | Ubuntu 22.04.5 LTS, Docker Engine |
| Migration source | MySQL 8.0.46, Ubuntu package (binary log on, sync_binlog = 1) |
| Migration target | MariaDB 11.8.9, official Docker image |
| Performance comparison | MySQL 8.0.46 and MariaDB 11.8.9, both in official Docker images with identical limits and InnoDB settings (see How the Engines Were Compared), run one at a time |
| Application | Bagisto 2.4.10, Laravel 12.62.0, PHP 8.3.33, running on the same machine as the database |
About Bagisto
Bagisto is an open-source e-commerce platform built on Laravel and Vue.js and developed by Webkul. It supports multiple channels, locales, and currencies.
About MariaDB
MariaDB Server is an open-source relational database that began as a fork of MySQL. It is released under the GPL and overseen by the MariaDB Foundation.
References
- Bagisto source code and v2.4.10 changelog: https://github.com/bagisto/bagisto
- MariaDB MySQL-to-MariaDB migration guide: https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/migrating-to-mariadb/moving-from-mysql/mysql-to-mariadb-migration-the-master-guide
- MariaDB JIRA MDEV-20912, utf8mb4_0900 collation support: https://jira.mariadb.org/browse/MDEV-20912
- MariaDB JIRA MDEV-13594, JSON arrow operators: https://jira.mariadb.org/browse/MDEV-13594
- MySQL 8.0.21 release notes, PROCESS privilege for mysqldump: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-21.html
- Laravel 12 configuration documentation: https://laravel.com/docs/12.x/configuration
More than a successful migration

What I actually quite like about this use case is the transparency. It’s not just that you can move over 157k rows across 147 tables without changing the application code (that’s a good result in itself, by the way), but that you’ve achieved compatibility.
The performance observations (the bits where MariaDB is better and the bits where it’s not) are equally useful to us. The different optimizer decisions serve as a reminder that application-level testing is absolutely vital when you’re moving from one database server to another.
At the MariaDB Foundation, the whole point of driving adoption is not just about getting applications to support MariaDB. It’s as much about listening to the developers, listening to their workloads and using that to make MariaDB Server better.
A massive thanks to the Bagisto team for their ongoing collaboration, their transparency and their contribution to the MariaDB community.
If you’re building an app that uses MariaDB, or if you’re considering a move from MySQL to MariaDB, we’d be very interested to hear about your experience as well!
Leave a Reply