I can't seem to be able to use the mariadb app i'm running in my PHP project

I want to be able to connect my mariadb app deployed on railway in my PHP script but when I try to use the domain i generated on railway to test it i always get an getaddrinfo failed: Host unknown error, i have been trying different things but nothing seem to work
Solution:
but yeah as it stands, you will only be able to connect to the database while on railway and only from the internal domain
Jump to solution
24 Replies
Percy
Percy11mo ago
Project ID: c85ae7e7-7613-4046-984a-d794087b9f9e
nepsenpai
nepsenpai11mo ago
c85ae7e7-7613-4046-984a-d794087b9f9e
Brody
Brody11mo ago
show us a screenshot of your service variables please
nepsenpai
nepsenpai11mo ago
The thing is I figured it out more or less, in the mariadb template I didn't have a variable for the host of the container, so I added to the project the github repo with my code and tried it with the private connection from railway, that worked but I want to know if there is a way to access it from outside the railway project it doesn't add to the usage
Brody
Brody11mo ago
you can't access a database over the private network, please show me us a screenshot of your service variables, keep the values hidden
nepsenpai
nepsenpai11mo ago
Brody
Brody11mo ago
where is the database hosted
nepsenpai
nepsenpai11mo ago
In that project, in railway
Brody
Brody11mo ago
railway doesnt provide a mariadb? did you deploy your own?
nepsenpai
nepsenpai11mo ago
I used a template, it seems to use some dockerfiles
Brody
Brody11mo ago
can you connect to it with the internal domain?
nepsenpai
nepsenpai11mo ago
I couldn't find that, only thing i found was the exposed port
Brody
Brody11mo ago
the internal domain is visable in the service settings of the database service you will not be able to connect to the database from the public railway domain, you can go ahead and remove the public domain from the service
nepsenpai
nepsenpai11mo ago
Could you show me where the internal domain should be? I can't find it in the database settings
Brody
Brody11mo ago
Brody
Brody11mo ago
again, in the service settings
nepsenpai
nepsenpai11mo ago
Oh you mean that Thats worked when I uploaded my code into the railway project But i couldn't access the database from outside
Brody
Brody11mo ago
okay so you can connect to the database with that domain when deployed to railway
nepsenpai
nepsenpai11mo ago
Thats correct
Brody
Brody11mo ago
this is expected, railway doesn't yet support tcp proxying for services ^
nepsenpai
nepsenpai11mo ago
Then if I want to connect to this database I need to deploy my code right? There is no other way right now
Brody
Brody11mo ago
there is, but its out of the scope of these help threads look into ngrok
nepsenpai
nepsenpai11mo ago
Ok, i will check that out, thx for the help
Solution
Brody
Brody11mo ago
but yeah as it stands, you will only be able to connect to the database while on railway and only from the internal domain