How to set database connection when host denies access from outside?

That’s why you need to setup a new Target, pointing to your server. Then switch to it, then edit your database connection step and enter the new database details. On save the file will be pushed to your remote server and connection will be made.

Actually to your website the database is not remote but local. So that is why you usually use localhost as address for your database server.

When the Wappler connection file gets uploaded to your site it gets executed there and connects “locally” to your database server

@Teodor. Wappler makes a connection to the database to check the connection settings before you can save them. If your mysql server does not accept remote connections then the initial connection check fails and you cannot save the settings and therefore they are not uploaded to the server. As @jowhiskey says it’s vicious circle. @George

That is not how it works. It connects through your server, as it pushes the files there - and that is not a remote access.
Wappler never requires remote connection. That is why you must setup your target to point to your remote server.

That is not true @Hyperbytes as I explained above Wappler accesses the database through your web server. So usually the database it is always localhost as it is from the point of view of your web server

Ok, i am not in the office at moment to check but i will later and video the issue. My provider does not allow remote access, I have never been able to connect directly to online databases with Wappler and i am not alone with that issue. I have to work locally then manually change the settings when going live.

1 Like

But manually changing the settings in the file is the same as changing them through the UI. On save this file is pushed to your server - then the script connects from the server, which already explained above is not a remote connection …

so just to resume - just leave the default “localhost” as database server name and it should be all ok :slight_smile:

Wappler never uses remote database connections, so there is no point of using remote address. It just uploads the file to your web server and access the database from there.

Neither my local or online provider use localhost. Very few seem to now.

I will set up an online database and send you the settings later and see if you can create a connection.

well if your database is on a different ip than your web server - then it is remote to your web server. But then remote connections are allowed from your web server to your database server (otherwise you never can access your database from your site)

But usually mysql databases created with panels like cpanel, plesk etc resides on the same server used as web server. So that is why localhost.

And then just use whatever address they provided you with - the same data you enter in the file manually. If it works when entered manually in the php file, then it works through wappler UI when you select the proper target.

That was the case once George but for is happening less and less now, especially hosts who are cloud based. All the major UK providers i deal or have dealt with used separate database servers now.

well that might be the case - but then you are provided with remote address that is allowed to be accessed remotely (ie throught your database server)

but when no remote connections are allowed - it is all local and that is the case of @jowhiskey - so it is actually the most simple solution :slight_smile:

Yes providers obviously allow access from web server to database server within their own platform but not from outside. Most cPanel setups now have remote access blocked but they can be authorised by adding your wan up to a allow list. This needs to be updated obviously when your ip address changes but that’s not the end of the world. Unfortunately some have more complex solutions which are not wappler friendly

Brian, that is not from outside. With Wappler we never access the database from outside of your server. All the connections are made only from your server, where the connection file is pushed on save/test.

We are going around in circles here. I will send you a some server settings and see what you can do with them.

1 Like

Sorry didn’t mean to tag you Teodor.

We maintain all our own servers and only allow connections locally to port 3306. Or with strong enforcement at the firewall level and through white lists we allow other interests to remotely connect to a specific server set-up for purely MYSQL. I usually edit the rule-set on the other servers to enable remote connection to 3006 for specific I.Ps when I’m working on them, then to maintain a static I.P I use a VPN while I undertake any activity. Remembering to close port 3306 when I am done. The moral of this is sometimes it is very helpful if you maintain your own infrastructure. It doesn’t cost as much as you think and allows you absolute control at root level across the box.

Wappler hosting at affordable prices… :slight_smile: I’m sure someone here could set-up WapHost. Might be a good revenue stream… Simple re-seller account…

:smiley:

2 Likes

Subscribe to a decent VPN like Proton and that resolves that issue (static I.P), It’s not ideal but it saves having to add a new I.P to your MYSQL host file and your Ignore/white lists everytime DHCP feels like messing up your flow :slight_smile:

Yes there are lots of workarounds @Dave and for us who are technical we can do that but for newbies coming to the product this could be a major issue and a lost customer. I will give George and Theodore access to my control panel for a now unused domain and see what they can do/suggest. I would be delighted if they can prove me wrong as this issue is a major headache for me and as a reseller makes me reluctant to recommend wappler due to the database connection issue. Fix it and i could offer WapHost at a very competative price

2 Likes