Skip to main content

MySQL

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 Definition

Below are the fields required for the MySQL connectors

connectors: 
type: MySQL
id: mysql
user: database_readonly_username
password: database_readonly_password
host: your.mysql.db.hostname.com
port: 3306
database: database_name
FieldExampleDescription
typeMySQLSpecifies the connection type, in this case “MySQL”.
idmysqlSpecifies the connection id, in this case “mysql”.
useryour_userAccess account username.
passwordpAssw0rd1!Access account Password.
hostmy-mysql-db.xxxxxxx.us-east-2.rds.amazonaws.comDatabase hostname.
port3306Database port (the default for MySQL is 3306).
databasemovielensThe name of the database that contains your user, item, and interaction views.
queryselect * from tableAn optional query to retrieve the data source.