This howto shows you how to create a connection to an mysql database.
An mysql connection supports :
Here are the attributes of the howto connection
comment: The default mysql data store
driver: com.mysql.cj.jdbc.Driver
password: my-secret-pw
uri: jdbc:mysql://localhost:3306/howto
user: root
varchar-default-precision: 2000
You can create an mysql connection:
In this howto, the password is expected to be stored in the MY_MYSQL_PASSWORD OS environment variable but there is more way to provide secrets.
To know how to pass and handle secrets, read more at Secret Value
In a Configuration Vault, to define a mysql connection with the name mySqlOne, you would write:
connections:
mySqlOne:
uri: jdbc:mysql://<hostname>:<port>/<dbname>
# driver is optional
driver: com.mysql.cj.jdbc.Driver
user: loginUser
password: ${MY_MYSQL_PASSWORD}
natives:
# https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html
key: value
With the tabul add command of the connection module, you can add a mysql connection with the name mysqlConnectionName:
tabul connection add "mysqlConnectionName" \
"jdbc:mysql://hostname:3306/dbname" \
--user login \
--password '${MY_MYSQL_PASSWORD}'
tabul connection add "mysqlConnectionName" "jdbc:mysql://<hostname>:<port>/<dbname>" ^
--user login ^
--password '${MY_MYSQL_PASSWORD}'