What's MySQL Host in Render

Hi all,

I tried to connect to a MySQL database using my local PC shell with this command

mysql -h localhost -D $MYSQL_DATABASE -u $MYSQL_USER --password=$MYSQL_PASSWORD

How can I find the database host in Render?


You can see the host via the ‘hostname’ value if you’re connecting via the internal network. If you’re connecting externally, look at the ‘External Connection String’ and the value right after the password. It should look something like ‘dpg-xxx-a.oregon-postgres.render.com’ depending on the region your database is hosted in.

Render Support, UTC+3

Hi Jeremy, thank you for your answer.

When I look up at MyQSL services, I get value like this ‘ssh srv-co4sk121hbls73c1lgog@ssh.oregon.render.com

So, when I try to connect it from my shell, I should put it like this?

mysql -h srv-co4sk121hbls73c1lgog@ssh.oregon.render.com -D $MYSQL_DATABASE -u $MYSQL_USER --password=$MYSQL_PASSWORD

My bad, I overlooked that you’re dealing with a MySQL database. MySQL databases aren’t managed by Render, and you’ve probably set it up as a private service, which isn’t directly accessible from outside. You have a couple of options: either deploy your database as a web service, which will give you a URL to connect to it, or set up a public service that acts as a gateway to your private service, allowing connections through a public method.

If you decide to move your MySQL database to a different service, remember to SSH into the current one, back up your data so you can restore it once you deploy a new service with a new disk.

Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.