phpMyAdmin with fortrabbit
Published
Updated
👨💼
Web-based database administration.
fortrabbit has no hosted phpMyAdmin. Run phpMyAdmin locally instead and connect it to the database of the environment through an SSH tunnel.
Connect a local phpMyAdmin
Add a server entry for the tunnel to the config.inc.php of the local phpMyAdmin:
$i++;
$cfg['Servers'][$i]['verbose'] = '{{app-env-id}}';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '13306'; // local port of the tunnel
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Open the tunnel in a terminal and keep it open while phpMyAdmin is in use:
ssh -N -L 13306:mysql:3306 {{app-env-id}}@ssh.{{region}}.frbit.app
Then open the local phpMyAdmin, pick the {{app-env-id}} server and log in with the user {{app-env-id}} and the database password from the dashboard. See MySQL access from the terminal for the tunnel.
Why not on fortrabbit
A web interface on the live environment exposes the production database to the internet. phpMyAdmin would also have to live in the git repository and be deployed with the app.
Alternatives
A native database client connects through the SSH tunnel by itself. AdminNeo, based on Adminer, is a single-file web-based alternative to run locally.