3 months ago
How do i have an access to my database remotely using heidisql?
2 Replies
3 months ago
railway databases aren't exposed by default so you need to use their tcp proxy thing
first go to your database service on railway, click into settings and look for the networking section. you should see something called "tcp proxy" - just enable that and put in your database port (3306 for mysql, 5432 for postgres). railway will give you a special domain and port number
then go grab your connection info from the variables tab. you need these specific ones:
RAILWAY_TCP_PROXY_DOMAIN (looks something like viaduct.rlwy.net or monorail.proxy.rlwy.net)
RAILWAY_TCP_PROXY_PORT (some random port number like 12345)
your database username (MYSQLUSER or PGUSER depending on what you're using)
your password (MYSQLPASSWORD or POSTGRES_PASSWORD)
database name if you want
now open heidisql and make a new session. here's the important part - use the TCP PROXY domain and port, not the regular MYSQLHOST stuff. that internal host only works inside railway's network
so in heidisql put:
hostname: the tcp proxy domain from above
port: the tcp proxy port (not 3306 or 5432)
username and password from your variables
pick mysql or postgresql from the network type dropdown
save and open and you should be good to go
3 months ago
if you just enabled tcp proxy for the first time you might need to redeploy your database service for it to actually work