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