Connect Streamlit to MySQL
Introduction
This guide explains how to securely access a MySQL database from Streamlit Cloud. It uses the mysql-connector-python library and Streamlit's secrets management.
Create a MySQL database
If you already have a database that you want to use, feel free
to skip to the next step.
First, follow this tutorial to install MySQL and start the MySQL server (note down the username and password!). Once your MySQL server is up and running, connect to it with the mysql client and enter the following commands to create a database and a table with some example values:
```sql
CREATE DATABASE pets;
USE pets;
CREATE TABLE mytable (
    name            varchar(80),
    pet             varchar(80)
);
INSERT INTO mytable VALUES ('Mary', 'dog'), ('John', 'cat'), ('Robert', 'bird');
