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
Percy12mo ago
Project ID: c85ae7e7-7613-4046-984a-d794087b9f9e
nepsenpai
nepsenpai12mo ago
c85ae7e7-7613-4046-984a-d794087b9f9e
Brody
Brody12mo ago
show us a screenshot of your service variables please
nepsenpai
nepsenpai12mo 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
Brody12mo 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
nepsenpai12mo ago
Brody
Brody12mo ago
where is the database hosted
nepsenpai
nepsenpai12mo ago
In that project, in railway
Brody
Brody12mo ago
railway doesnt provide a mariadb? did you deploy your own?
nepsenpai
nepsenpai12mo ago
I used a template, it seems to use some dockerfiles
Brody
Brody12mo ago
can you connect to it with the internal domain?
nepsenpai
nepsenpai12mo ago
I couldn't find that, only thing i found was the exposed port
Brody
Brody12mo 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
nepsenpai12mo ago
Could you show me where the internal domain should be? I can't find it in the database settings
Brody
Brody12mo ago
Brody
Brody12mo ago
again, in the service settings
nepsenpai
nepsenpai12mo 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
Brody12mo ago
okay so you can connect to the database with that domain when deployed to railway
nepsenpai
nepsenpai12mo ago
Thats correct
Brody
Brody12mo ago
this is expected, railway doesn't yet support tcp proxying for services ^
nepsenpai
nepsenpai12mo 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
Brody12mo ago
there is, but its out of the scope of these help threads look into ngrok
nepsenpai
nepsenpai12mo ago
Ok, i will check that out, thx for the help
Solution
Brody
Brody12mo 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