How we rebuilt phpMyAdmin
Abhinav Gautam · 27 November 2026
Almost every team at [cB] opens phpMyAdmin at some point in the week. It is how people look at a table, fix a row, run a query someone sent them on chat, or take a quick export before a risky change.
It does that job well, and it has done it for twenty-five years. But running it was starting to cost us. It needs PHP and a web server next to it, and both need patching. It is slow to move around in once a database has a few hundred tables. It is hard to use on a phone, which is exactly where you are when someone calls at night about a stuck order. And there was no clean way for our scripts and agents to talk to it.
So we rebuilt it. BetterMyAdmin is phpMyAdmin written again in TypeScript and React: one Node.js process or one Docker image, no PHP, no Apache. It went from the first written specification on 8 October to version 1.0.0 on 21 October, and it is on 1.0.35 today. It is open source under the same licence as phpMyAdmin, at github.com/cB-Sigma/better-myadmin.
This post is about how we did it: why we copied phpMyAdmin instead of redesigning it, how we check that the copy is faithful, what we added on top, how we keep up with phpMyAdmin as it changes, and how we fix things without breaking the rest.

A copy, not a redesign
The first decision was the one everything else hangs on. We did not want a "modern database tool inspired by phpMyAdmin". We wanted phpMyAdmin.
The reason is the habits. phpMyAdmin has a long tail of small behaviours that people rely on without ever thinking about them. Clicking a foreign key value jumps to the row it points at. Double-clicking a cell lets you edit it. Ctrl+Enter runs the query. The tree on the left remembers which databases you had open. "Show all" refuses to load a table above a certain size. A redesign usually loses a hundred of these, and the people who used them notice every single one.
So the rule became simple. Same pages, same tabs in the same order, same names, same settings, same generated SQL. If you know phpMyAdmin, you already know BetterMyAdmin. The modern part is how it is built and how it feels: it is a single-page app, so moving between tables is instant, large tables scroll smoothly, and every page fits a phone.
Being a copy also made it easy to adopt. It reads the same configuration storage tables phpMyAdmin uses for bookmarks, relations and saved settings, so both can run against the same server and share them. It accepts the same Docker environment variables, so switching is often just a change of image name. An existing config.inc.php converts with one command.
Writing down what phpMyAdmin does
You cannot copy something faithfully if you only remember roughly how it works. Before writing any application code, we wrote down what phpMyAdmin actually does, by reading its source at one fixed commit: the controllers, the templates and the JavaScript.
That became a set of feature documents, one per area: navigation and login, browsing, insert and edit, table operations, database operations, server pages, import and export, settings, and the SQL editor. Each one ends in a checklist of small behaviours. There are 707 items across all of them, and a feature is done only when every item on its list has a passing test, or a written reason why it does not apply.
People write checklists, and people miss things. So we also pulled lists out of phpMyAdmin mechanically, by running and parsing its own code:
- every route it answers;
- every button, input, select and link in every template;
- every configuration setting and its default;
- every translated message;
- every click, key and request handler in its JavaScript.
Each item on those lists has to be mapped to the part of BetterMyAdmin that replaces it, or to a recorded reason it is different. A check runs on every push and fails the build if anything slips. Coverage is at 100 per cent on all five lists, and it cannot go down without someone noticing.
Comparing against the real thing
A checklist tells you a behaviour exists. It does not tell you it behaves the same. For that, we run phpMyAdmin itself next to BetterMyAdmin and compare the two.
Every query a database tool sends ends up in MySQL's general log. So for a write, say adding a column, a script does the same thing in both apps through a real browser, reads the log for each app's connection, and diffs the SQL. They have to match. We allow a short, listed set of differences in how we read data, because there is sometimes a faster query for the same answer. A difference in what we write is never allowed.
Exports are compared byte for byte, after removing the header line that names the tool and the time. Imports are compared by importing the same file in both and checking that the tables end up identical. For the pages themselves, a second harness opens the same page in both apps and lists every visible control: its kind, its label, its value, its options, whether it is checked or disabled, and where it sits on the page. Then it clicks through the same steps in both and compares again after each one, so things that appear and disappear are checked too.

orders table in phpMyAdmin.
There are 1,074 of these comparison tests now, and 148 page comparisons. They run on MySQL 8.0 and 8.4 and on MariaDB 10.11 and 11.4. Underneath them sit about ten thousand unit tests, 442 integration tests against real databases, and 367 browser tests that click through the app the way a person would.
When phpMyAdmin is wrong
Copying faithfully means copying the odd parts too. When we find something in phpMyAdmin that looks like a bug, we do not quietly fix it. We write it down in a register of quirks, and by default we reproduce it, because someone somewhere may depend on it. There are 76 entries in that list.
Some differences we chose on purpose, and those go in a second list with the reason next to each one. There are 62 of them. A few examples:
- phpMyAdmin keeps your encrypted password in a browser cookie. We keep only a session id there, and the credentials stay on the server, so a stolen cookie is worth nothing on its own.
- Login attempts are rate-limited by default.
- One of phpMyAdmin's transformations can run shell programs on the server. Ours can only use a fixed set of built-in formatters.
- Where phpMyAdmin stops with a PHP error, for example on a character set it cannot convert, we show a clear message instead.
Every one of these is a decision someone made and wrote down, not something that drifted.
What we added
The copy came first. Once it was there, we added the things people usually open a second app for. None of them change how the existing pages behave; they sit on top.
There is also a slow query page that groups the most expensive statements by their shape and runs an EXPLAIN on any of them in one click, and three new themes next to phpMyAdmin's own, each with a light and a dark mode. pmahomme, the theme phpMyAdmin users know, stays the default.

Phones got real attention. Every page fits a small screen: the navigation slides in from the side, wide tables scroll in place, dialogs go full screen and every touch target is at least 40 pixels. The desktop layout does not change at all.

The last addition is for programs rather than people. BetterMyAdmin has a JSON API and a built-in MCP server, so a script or an AI agent can look at schemas and run SQL. It always does that as a MySQL user, with that user's privileges and nothing more. An agent cannot do anything the account it signed in with could not do.
Keeping up with phpMyAdmin
phpMyAdmin is alive. Commits land on its main branch most days, and a copy that stops following them slowly becomes a different program. So following upstream is part of the process, not a chore we get to when we remember.
Every morning a routine fetches phpMyAdmin's main branch and lists what is new since the commit we are pinned to. Each commit is sorted by the files it touches. A change to behaviour, meaning its PHP, templates, JavaScript or themes, is read, ported into our code and our feature documents, and given a comparison test that would fail without the change. Translations are imported in a batch. Changes to their CI, static analysis or PHP-only tests are written down as not applicable, with a line saying why.
Every single commit gets an entry in a ledger. So far there are 219: 110 ported and 109 that did not apply to us. The build checks the ledger too. The pinned commit cannot move forward past a commit that has no decision recorded against it, so nothing upstream can be skipped by accident.
When the pin does move, everything derived from phpMyAdmin's code is regenerated against the new commit, the reference copy of phpMyAdmin is rebuilt, and every test suite runs again. Then a release goes out.
The sync this week is a good example. phpMyAdmin fixed how an import handles the character set you choose for the uploaded file. We ported all three fixes. A file that is not valid in the chosen character set now stops with a message saying exactly that, the list only offers character sets that can actually be converted, and the home page now shows the connection collation that is really in use. While porting it we also removed an old line of ours that put the typed character set name straight into an SQL statement.
Fixing things without breaking others
The comparisons make it cheap to change code with some confidence. That matters most when we fix things, because a fix is where regressions like to hide. Here is a recent one.
On the SQL page there is a Delimiter field, and phpMyAdmin will not run a query when it is empty. Ours behaved the same when you clicked Go. But Ctrl+Enter took a different path and ran the query anyway, and on a phone the field is folded away under Options, so the browser had nothing to point at when it refused. We now send Ctrl+Enter through the same form check as the Go button, and on a phone the Options section opens and puts the cursor in the field. Both cases have a browser test now.
How we run it
Internally, nobody types a database password into BetterMyAdmin. It sits behind Cloudflare Access, so you sign in with your work account first. A small sign-on page then reads who you are from Cloudflare's token and hands BetterMyAdmin the matching database login, using the same signon mechanism phpMyAdmin has always had. When the session runs out, it signs you in again without you noticing.
Releases are boring on purpose. A version is only tagged after CI is green on the exact commit. The release builds the Docker image, and only once that image exists do we bump the version our internal deployment pins to, which triggers its own build. If a step fails, nothing downstream moves.
What we believe
If there is one idea underneath all of this, it is that "the same as phpMyAdmin" has to be something you can measure, or it is just a slogan. That is why the checklists have tests linked to them, why the inventories come from phpMyAdmin's own code instead of from memory, why the comparisons run against the real thing, and why every upstream commit has a decision written next to it.
The rest follows from respecting the people who already use the tool. Their habits are the product. We changed how it is built, how fast it feels and where you can use it. We tried very hard not to change what it does, and where we did, we wrote down why.
If you run phpMyAdmin today, try swapping the image name. Your settings should carry over, and if something you relied on does not work the way it used to, that is a bug, and we would like to hear about it.



