Connecting to MySQL on Siteground

pedro's profile image pedro posted 3 months ago in General Permalink

I am stuck try to get remote access to MySQL8 databases on Siteground servers. Siteground Support say "I am not familiar with the software you are using" and can't really make any suggestions. Any help would be appreciated.
Using HeidiSQL 12.8.0.6927

First image contains the database user, user password, and database name Second image contains the IP of the live site, plus username and password created with Sitegrounds SSH Keys Manager, and taken from Sitegrounds SSH Credentials. Third image shows where the log file would be, but there is currently no /log/ folder, presumably as I have never been able to connect.

Any suggestions are welcome

3 attachment(s):
  • Capture
  • Capture2
  • Capture3
pedro's profile image pedro posted 3 months ago Permalink

I should have added that at one point, I allowed "access to all" (%) on the database, but still got the error message. Access to all is now removed.

ansgar's profile image ansgar posted 3 months ago Permalink

Is there any error message ? I can't see one. The setup looks fine so far.

pedro's profile image pedro posted 3 months ago Permalink

Error message is: Connection failed Can't connect to server n '127.0.0.1' (10061)

ansgar's profile image ansgar posted 3 months ago Permalink

That error tells me you don't get a physical connection to the host/ip, which is a tunneled SSG server in your case. So I would try to establish the SSH connection manually, testwise, then connect HeidiSQL to 127.0.0.1 again but without integrated SSH tunnel. My guess would be your SSH connection already fails.

pedro's profile image pedro posted 3 months ago Permalink

I have a number of clients on Siteground, and Siteground have just told me "direct SSH access to databases hosted on our servers is not available." So it looks lik I need another method.

ansgar's profile image ansgar posted 3 months ago Permalink

Ok in that case you cannot use HeidiSQL I'm afraid. There is just that SSH tunnel and/or direct connection possible.

pedro's profile image pedro posted 3 months ago Permalink

Sadly, I think that you are correct...

pedro's profile image pedro posted 3 months ago Permalink

I missed the fact that I can have direct connection! The message from Siteground support was "direct SSH access to databases hosted on our servers is not available." But he didn't mention direct connection. None of the data is seriously critical, and it can only be reached from my IP, so:

Network Type: MariaDB or MySQL (TCP/IP) Library: libmariadb.dll Port: 3306 And your own Hostname/IP, User, Password, and Database.

It's working. Not 100% secure, but there is no critical or personal data (personal data must have a higher level of security) - but to get in, you will have to know "my" hostname, user, etc., and connect from the same IP as I do.

That's the way I have to go, due to Sitegrounds "higher security"

ansgar's profile image ansgar posted 3 months ago Permalink

Good find!

And yes, direct access is always considered a potential risk. But you may have a complex password, and limit the user privileges to only needed ones. You may even set up a SSL certificate used for connecting.

ibtisam_mib's profile image ibtisam_mib posted 2 months ago Permalink

Choose MySQL's SSH tunnel as the network type. Use your SiteGround SSH hostname, along with your username/password or the private key generated from SG’s SSH Keys Manager. Setup the database details for your localhost. Also, ensure that ports 3306 (MySQL) and 22 (SSH) are open.

pedro's profile image pedro posted 2 months ago Permalink

First support person: "I am afraid that direct SSH access to databases hosted on our servers is not available."

Second support person: "Indeed, a direct SSH connection do the database cannot be established, as my colleague has explained.

You can establish a SSH connection to your website's account first, and then you can also connect to the database, using the tutorial by my colleague:

https://dev.mysql.com/doc/refman/8.4/en/connecting.html

I gave up, my first Siteground invoice period is about to end, and the price is about to change from 8.50 EUR to 40.00 EUR a month, and there are other issues, plus it's only 40G storage, so I will be moving, bringing the move forward a couple of months.

At the moment, Hostinger is favourite - 4.00 EUR for 200G storage (saving me 36 EUR!), going up after 4 years to 20 EUR.

Please login to leave a reply, or register at first.