It Started With a Bug
When I was building VMMS — a voucher management system
for government offices — everything worked fine locally.
MySQL. Clean queries. Fast results.
Then I deployed to a server running MariaDB.
Half my charts broke.
The Problem
I had written date queries like this all over the codebase:
// This breaks on MariaDB DB :: table ( 'voucher_transactions' ) -> selectRaw ( 'MONTHNAME(created_at) as month, COUNT(*) as total' ) -> groupByRaw ( 'MONTH(created_at), MONTHNAME(created_at)' ) -> get ();
Enter fullscreen mode
Exit fullscreen mode
MONTH() and MONTHNAME() are MySQL functions. They work
fine on MySQL but behave differently on MariaDB — especially
when combined with GROUP BY .
The result? Months showing up in the wrong order.
Duplicate entries. Missing data.
Why This Happens
MySQL and MariaDB have diverged over the years.…