Preparation
To allow Shaped to connect to your MySQL database, you need to create a read-only user and share those credentials through the Create Model endpoint. You can create a read-only user on a MySQL database with the following commands:
# 1. Create a new user.
CREATE USER '[username]'@'%' IDENTIFIED BY '[password]';
# 2. Grant the user read access to all the tables in the schema. Note you can also
# restrict this to your specific user, item and interaction views.
GRANT SELECT ON [database_name].* TO '[username]'@'%';
# 3. Save.
FLUSH PRIVILEGES;
Connector Config Definition
Below are the fields required for the MySQL connection_config
"connector_configs": [{
"type": "MySQL",
"id": "mysql",
"user": "database_readonly_username",
"password": "database_readonly_password",
"host": "your.mysql.db.hostname.com",
"port": 3306,
"database": "database_name",
}]
Field | Example | Description |
---|---|---|
type | “MySQL” | Specifies the connection type, in this case “MySQL”. |
id | “mysql” | Specifies the connection id, in this case “mysql”. |
user | “your_user” | Access account username. |
password | “pAssw0rd1!” | Access account Password. |
host | “my-mysql-db.xxxxxxx.us-east-2.rds.amazonaws.com” | Database hostname. |
port | 3306 | Database port (the default for MySQL is 3306). |
database | “movielens” | The name of the database that contains your user, item, and interaction views. |