1

I'm trying to have my SlashDB REST API query a MySQL database, which it must connect to over SSH.

The connection string isn't successful and I can't say I'm surprised, because SlashDB has a place in its template for the DB username and password, but no options for the SSH / OS username and password.

wizard

How can I tweak this example string to include necessary and sufficient details?

8.8.8.8:3306/somename

This is associated with the following JSON (note that you can't directly edit the JSON):

{
    "db_encoding": "utf-8",
    "owners": [
        "admin",
        "user",
        "root"
    ],
    "execute": [
        "admin",
        "user",
        "root"
    ],
    "creator": "admin",
    "read": [
        "admin",
        "user",
        "root"
    ],
    "db_type": "mysql",
    "autoload": true,
    "write": [
        "admin",
        "user",
        "root"
    ],
    "connect_status": "Disconnected",
    "connection": "8.8.8.8:3306/somename",
    "sysuser": {
        "dbuser": "user",
        "dbpass": "pw"
    },
    "db_schema": "somename",
    "offline": true,
    "alternate_key": {},
    "desc": "blah blah blah"
}

Since you can directly edit the connection string, I tried prepending user@ but it didn't help.

Victor Olex
  • 1,458
  • 1
  • 13
  • 28
Hack-R
  • 22,422
  • 14
  • 75
  • 131

1 Answers1

1

SlashDB does not have the SSH connectivity to MySQL built-in. However, there is a work around.

  1. Establish SSH tunnel from SlashDB host to your database host. We are using local port 3307 in this example.

    ssh -f user@XX.XX.XX.XX -L 3307:mysql1.example.com:3306 -N

  2. Configure the connection string in the GUI as follows:

    • Database host: localhost
    • Database port: 3307
    • Other parameters as before

See also: MySQL connection over SSH tunnel - how to specify other MySQL server?

Having said that, generally the pattern to avoid making your MySQL server public yet allow for public REST API is to install SlashDB in the same subnet as your database. Then open up ports 80 and 443 in the firewall for SlashDB host. This also ensures maximum performance of your SlashDB to MySQL connections.

Community
  • 1
  • 1
Victor Olex
  • 1,458
  • 1
  • 13
  • 28