Repository navigation
Open the project's own database in magebox phpmyadmin open - #163
Merged
Merged
Conversation
The shared phpMyAdmin container knew a single server (PMA_HOST): the default MySQL version, or another version picked by map iteration order. `open` always went to that server's start page, so a project on another MySQL or MariaDB version showed the wrong server and none of its data. phpMyAdmin now gets every MySQL and MariaDB container in PMA_HOSTS, in a fixed order with the default first, labelled by version. `open` looks up the project's database container in the running container's PMA_HOSTS and opens `?server=N&db=<name>` there. If the container does not list it yet, the compose file is regenerated, which makes compose recreate the container. Outside a project it opens the start page as before.
peterjaap
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
There is one phpMyAdmin container for all projects, configured with a single server:
That host came from
firstDBHost: the default MySQL version, or else whichever version Go's map iteration returned first.magebox phpmyadmin openalways openedhttp://localhost:8036on that server. A project on MariaDB 12.3, for example, landed on MySQL 8.0 and saw none of its own data. The only workaround was a second, hand-started phpMyAdmin container.Alignment with the MageBox vision
This change brings the command in line with the principles in the project vision:
openignored the project and the developer had to find the right server by hand. Now.magebox.yamlalone decides which server and database open.open, without the developer needing to know a fix exists. Detection reads the running container's actualPMA_HOSTSrather than assuming the compose file matches it.Fix
Compose (
internal/docker/compose.go)PMA_HOSTS, with readable labels inPMA_VERBOSES(MySQL 8.0,MariaDB 12.3).PMA_HOSTis no longer set, because the image ignoresPMA_HOSTSwhenever it is present.firstDBHostis replaced bydbHostsand removed.magebox phpmyadmin open(cmd/magebox/phpmyadmin.go)getDbInfoasmagebox db), finds its position in the running container'sPMA_HOSTS(viadocker inspect), and opensindex.php?route=/database/structure&server=N&db=<project db>.compose up -drecreates the container, and the lookup runs again.Docs and changelog:
commands.md,services/phpmyadmin.md, and an[Unreleased]entry inCHANGELOG.md.Testing
PMA_HOSTS/PMA_VERBOSESrendering and the absence ofPMA_HOSTdbHostsordering, table-drivenPMA_HOSTphpmyadmin:latestcontainer withPMA_HOSTS=magebox-mysql-8.0,magebox-mariadb-12.3:server=2&db=<db>opensMariaDB 12.3 / <db>, andserver=1opens MySQL 8.0.make lint: 0 issuesmake test: passes