Database manager and remote connections

If it helps,this is one of my database servers set up as Server connect and Direct Database connections

image

Server Connect

Direct Connection

1 Like

Thank you so much!

For the Host address, port and other information as shown in your images, would I get this from the web host where the database resides? For instance, Bluehost?

For instance, your Direct Database Connection: Host has more details, i.e. mysql.stackcp.com. Mine only shows the Host as localhost, with no Port.

I assume that the User info, and Password info would be the same used as per the existing Server Action DB connection info.

Your info helped me so much. It caused me to do more research and this is what I found:

Configuration Settings:

Use the following configuration settings for connecting to your database

Host name = (use the server IP address)
Database name = (cpanelUsername_databaseName)
Database username = (cpanelUsername_databaseUsername)
Database password = (the password you entered for that database user)
MySQL Connection Port = 3306
TCP or UDP, either is fine.

1 Like

Allowing a Remote Server to Access Your Database

Before connecting to MySQL from another computer, the connecting computer must be enabled as an Access Host .

  1. Log into cPanel and click the Remote MySQL icon , under Databases.
  2. Type in the connecting IP address, and click the Add Host button .
  • Note: You can find and add your IP address directly from this tool. Look for Your IP is: 123.123.12.123 [Add] . Clicking the [Add] link will input your IP into the field box below.
  1. Click Add , and you should now be able to connect remotely to your database.
1 Like

Found a bug though, now when i go back into the direct database connection settings they have adopted the server connect settings!

@Teodor, need a separate bug report or will this do as everything is in here?

2 Likes

Yes, having the option of what seems to be two choices: Server Connect or Direct Connect. Which should we choose?

Being able to edit and build DBs inside Wappler is highly preferred over logging into our phpMyAdmin each time to build or make changes.

Education is what we need to be able to appreciate the awesome tool this appears to be!

I would suggest that in 95% + cases, server connect will be the the correct option, direct connection is only for servers which have additional security which stops client access outside the server network. Basically try server connect first, only use direct as a fallback in the case of failure

I have to do something similar JR, authorise my IP address but I must also use different credentials.

1 Like

Server connect connection is to connect to your database from the web server . The host name there will be mostly localhost if your database and web server run on the same server

While the direct connection will be to connect remotely directly from Wappler to your database server. The host name there will be the full remote address of your database server and you will have to allow indeed remote access - at least for the ip you are on.

1 Like

You’ve got me on the trail now. I will post my findings when I’m successful. Perhaps this will help others like myself… ‘very little experience outside the beaten path of phpMyAdmin’. Ha!

1 Like

Yes if you clearly find out how it needs to be done in cPanel (maybe @psweb can help) - I will add it to my guide above.

I have had to use this from time to time depending on my server setup, load balancing servers etc.

Basically in cPanel, under Databases where you find the link to phpMyAdmin, you will see Remote MySQL, Click it.
Add your current Public IP to the Host and a comment if you like, then just click Add Host.
In Wappler test your connection and it should work now without being blocked.

The pain with this is that I am personally on dynamic IPv4 addressing, so every day or 2 I had to go and change to my newest supplied IP. I have started using the Wildcard to match the CIDR notation or the range I am normally given, which is great but obviously less secure in general.

2 Likes

After researching the connection problem I found the following could be causing the failures:

Process of Elimination Report

  1. Firewall - Disabled my firewall. Test: FAIL
  2. Whitelist my local IP - After whitelisting my IP address with the Host. Test: FAIL
  3. Search for IP address of DNS ( https://dnschecker.org/ip-location.php ). After finding the IP of my DNS, I entered it in as Host. I then tried Port 3306. Test: FAIL
  4. I then left the Port blank. Test: BINGO!
  5. We’re connected! The tables are in view!
3 Likes

What an adventure :slight_smile:

Well yes there is a lot of security settings that might get in the way.

Still better safe than sorry :slight_smile:

Also maybe don’t show here in the screenshots your exact server settings as it is a public place and everybody is watching…

1 Like

You can use an FQDN with cPanel (info here). If you have an account with a dynamic DNS provider (I use noip.com), you could avoid having to update IP addresses in cPanel (at least I would have thought so). You can use this to restrict FTP access too (using cPanel’s FTP enforcer).

2 Likes

After much searching this @psweb post worked for me on the first try. :rocket: Thanks Paul ! :beers:
Click “Remote MySQL”

Add your workstations “Host IP Address”

2 Likes

Hello All,
I’m currently in this situation also (already own and use No-ip) - I’m all set up but…
How do I tell wappler to send commands with a hostname rather than my IP address?
I’ve set the correct primary DNS suffix for my laptop but when I try and test my database connection I get the error trying to connect via:
MyDBUserName@MyIpAddress
rather than
MyDBUserName@MyNoipDomainName.
Appreciate this isn’t specifically a Wappler issue but any help would be grateful.
Cheers Anyone that can help…

I add the hostname to the whitelist in FTP Enforcer, in cPanel. I don’t use the hostname anywhere in Wappler.

I’m using mochahost it is cPanel based hosting but I don’t see FTP Enforcer?
The FTP transfers are fine (one way communication outbound).
But Mysql communications in direct database connections aren’t being accepted because wappler is using my ip address rather than a hostname.
I can whitelist the mysql remote connection by ip address fine, but not using a hostname?
It means I have to go into cPanel and whitelist my new ip every time I reconnect to my mobile hotspot, which can be up to 10 times a day. (i’m in and out of a vehicle constantly…)
thanks

I’m afraid I’ve never really looked into this as it’s always just worked. I always mirror the local and remote setup (database names, usernames and passwords etc), so haven’t taken much notice of the way the Database Connector has changed over the years. I use WAMP locally.

I don’t use Database Manager - I manage databases with Navicat. I use an HTTP tunnel to enable the connections.

I’m afraid this is not a very useful answer.

1 Like