I’m trying to utilize a mysql database in a subdomain. The only way I can get it to connect is to add the main domain as a target (located in public_html) but I would rather have the subdomain as it’s own project
You seem to be confusing mySQL with your web root. I’m not sure what you’re trying to do exactly.
I agree with Niall, you should have no issue using MySQL with a subdomain. Be sure your project is set up as a separate project than your main domain.
Thanks for your reply. I’ll try to explain better
I have one MySql database set up in my hosting plan and my main domain is hosted in public_html.
I can set up a connection in that project fine using these settings and my sql pointing to localhost. it connects fine
My subdomain is set up as a separate project in wappler lets call it xxx
the hosting plan it is in the folder XXX (not public_html_XXX)
in wappler if i set up my target as the XXX folder it connects and test fine
I set up the mysql connection as localhost and it does not work
If i add a second target in this project using the main domain and public_html the data works fine.
Must my subdomain be hosted inside the public_html forlder like public_html/xxx ?
The subdomain has worked fine until I tried this
In most hosting environments public_html would be the folder containing your sub-domain. Some hosting environments also default to subdomain/xxx for example. It is all down to your hosting and how it is set-up. You could always connect and upload your server actions to your 'main domain' and select those actions in Wappler in a totally separate Project within your sub-domain Project. You cold also try to connect to the IP of the MySQL server rather than using localhost?
I fail to see how the directory used has any relation to a subdomain tbh. I mean, I’d just install my application into whatever directory I want on the server and setup a vhost entry to point the domain/subdomain to my app…
So long as the database server is running on the same VPS as Apache, then there should be no issues with using localhost.
Thanks @niall_obrien @Dave @brad for your feedback. Given your info i set up a fresh subdomain in my hosting plan and tested it an it connects just fine (go figure) I’m not quite sure why it worked but it seems fine now. Thanks for helping me clarify this issue, this is the first time I’ve ever connected to data via my subdomain. Until now the subdomains I made were just regular page.