To connect a MySQL Data Source go to Data Sources page.
Click on the green Add Data Source button and choose MySQL.
Then you have to insert these configurations:
- Type: type of connection, it can be Direct or SSH Tunnel
- Name: name you can define to identify this database connection.
- Database: database name.
- Host: hostname of the database.
- Port: port the database runs on (default is 3306).
- Username: database user login.
- Password: database user password.
- Security: check if you want the connection to be SSL secured.
- Show Advanced: optional additional configuration.
Direct Connection #
Allows Viur to connect directly to your database, in most cases you need to allow the connection from the Viur Server.
Important Note: You may need to whitelist the Viur Server IP 188.8.131.52
SSH Tunnel Connection #
A SSH Tunnel consists of an encrypted tunnel created through a SSH protocol connection it can be used to transfer unencrypted traffic over a network through an encrypted channel.
It is useful if you do not wish to modify any firewall rules, you can use an SSH tunnel to make an outbound encrypted request from your network to ours instead.
It allows Viur to connect to your database through a SSH Server, however you need to configure additional information as follows:
- Host: hostname or IP address of the SSH Server.
- Port: port of the SSH Server.
- Username: SSH Server user login.
- Authentication Type: type of the authentication, which can be Password or a Key.
- Password: password for authentication.
- Private Key: key for authentication, it must be provided in OpenSSH format.
- Passphrase: password for the security private key.
Tip: You may click Connect button to check the current SSH configuration.
- Though we use the highest security best practices, we recommend that you create a read-only user for the database.
- If your are using a password manager like LastPass, it might wrongly replace your database credentials for the credentials you use to authenticate in Viur, causing an error when saving the connection. To avoid this, you must disable the password manager browser's extension temporarily.
Create a Database Read-Only User #
This SQL command creates and grants the user described by [username] and [password] with read-only access to ALL tables in your database defined by [database_name].
GRANT SELECT, SHOW VIEW ON [database_name].* TO [username] IDENTIFIED BY '[password]'; FLUSH PRIVILEGES;
If you would like to restrict access to only certain tables in your database separate the various tables names [table_name] with a comma as shown below.
GRANT SELECT, SHOW VIEW ON [database_name].[table_name],[database_name].[table_name], ... TO [username] IDENTIFIED BY '[password]'; FLUSH PRIVILEGES;
Show Advanced #
These configurations are optional:
- Query Timeout: maximum time the query is allowed to run before the database engine cancels it.
- Cache Duration: the duration of time the retrieved data will be stored on Viur's cache.
- Timezone: the dates will be shown in relation to the chosen timezone.
Don't forget to Press Save to add this connection.