Does Streamlit have a Build-In Support of Mysql Datasource?

I have noticed through the documentations of Streamlit that, Streamlit only have native support of the following datasources:

But what if I want handle data stored in Mysql?
Is it invalid to get my Mysql connection configurations be written and used through “./streamlit/config.coml” like what we can do in the situation of PG database (one of the DB that have native support of streamlit) like the following:


[postgres] --------------------------------------- Can I change this to [Mysql]?
host = “localhost”
port = 5432
dbname = “xxx”
user = “xxx”
password = “xxx”

Hi @TonyZhao, welcome to the Streamlit community!

Please note that the links you are highlighting are tutorials, they isn’t any code inside Streamlit that enables this functionality. So in terms of using MySQL, yes, you can use it in a similar manner as the Postgres example. The most important part is getting your MySQL database connection code correct, and then the .streamlit/secrets.toml file will hold your MySQL credentials instead of a different database.


Hi randyzwitch
I have understand your explanations, Thanks!
And now I have successfully get connection to Mysql with streamlit like we do to PG database!


In our latest docs, we now have a tutorial on connecting Streamlit to MySQL! :partying_face:

Based on the way our docs are built, it will show up in stable after the next Streamlit release, which will make the information easier to discover.

Happy Streamlit’ing! :balloon:

1 Like