# Sequel Ace + Coolify Staging MySQL (Reliable Access Guide) This guide is for when Sequel Ace SSH mode fails against a Coolify-hosted app where MySQL is **internal-only**. ## Why Sequel Ace built-in SSH can fail on Coolify In many Coolify setups, MySQL is not exposed on host `127.0.0.1:3306`. It runs only inside Docker network (service name like `mysql`), so direct SSH-to-host + DB host `127.0.0.1` will fail. ## Recommended method (works with internal-only MySQL) Use a terminal tunnel to the **current MySQL container IP**, then connect Sequel Ace to local `127.0.0.1:3307`. ## 1) On your Mac: get MySQL container IP from server Replace: - `SERVER_USER` - `SERVER_HOST` ```bash MYSQL_IP=$(ssh SERVER_USER@SERVER_HOST "docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \$(docker ps --format '{{.ID}} {{.Names}}' | awk '/mysql|mariadb/{print \$1; exit}')") echo "$MYSQL_IP" ``` If this prints an IP (example `172.18.0.5`), continue. ## 2) Create SSH tunnel (keep terminal open) ```bash ssh -N -L 3307:${MYSQL_IP}:3306 SERVER_USER@SERVER_HOST ``` Keep this terminal open while using Sequel Ace. ## 3) Create Sequel Ace connection Use **Standard** (not SSH) because tunnel is already created: - Name: `Dewemoji Staging` - Host: `127.0.0.1` - Port: `3307` - User: your MySQL user (example `dewesql`) - Password: your MySQL password - Database: `dewemoji` Click **Test Connection** then **Connect**. ## 4) Verify database quickly Run in Sequel Ace: ```sql SHOW TABLES; SELECT NOW(); ``` ## Troubleshooting ### A) `Connection refused` - Tunnel terminal is closed, or command failed. - Re-run step 2. ### B) `Access denied for user` - Wrong DB username/password. - Confirm app/coolify env values for DB credentials. ### C) `Unknown database` - Wrong DB name. - Check with: ```sql SHOW DATABASES; ``` ### D) No `MYSQL_IP` returned - Server user cannot run Docker commands. - Test manually: ```bash ssh SERVER_USER@SERVER_HOST "docker ps --format '{{.Names}}'" ``` - If permission denied, use a user with Docker access. ### E) Tunnel worked yesterday but not today - MySQL container IP changed after redeploy/restart. - Re-run step 1 and step 2 each session. ## Optional: one-liner (resolve + tunnel) ```bash ssh -N -L 3307:$(ssh SERVER_USER@SERVER_HOST "docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \$(docker ps --format '{{.ID}} {{.Names}}' | awk '/mysql|mariadb/{print \$1; exit}')"):3306 SERVER_USER@SERVER_HOST ``` ## Security note Do not expose MySQL publicly in Coolify just for GUI access. Tunnel-only access is safer for staging and production.