Complete Tutorial on Streamlit Playlist : • Streamlit Website
Learn how to build dynamic web applications by connecting Streamlit, a powerful Python library, to a XAMPP MySQL database. In this tutorial, we'll guide you through the process of setting up XAMPP, creating a MySQL database, and establishing a connection with Streamlit. You'll discover how to execute SQL queries, fetch data from the database, and display it in real-time using Streamlit's intuitive UI components. Whether you're a beginner or an experienced developer, this step-by-step tutorial will empower you to create interactive web apps that interact with your MySQL database. Get ready to unleash the potential of Streamlit and take your web development skills to the next level!
This guide explains how to securely access a remote MySQL database from Streamlit Community Cloud. It uses st.experimental_connection and Streamlit's secrets management.
Your local Streamlit app will read secrets from a file .streamlit/secrets.toml in your app's root directory. Learn more about Streamlit secrets management here. Create this file if it doesn't exist yet and add the database name, user, and password of your MySQL server as shown below:
Documentation : https://docs.streamlit.io/knowledge-b...
.streamlit/secrets.toml
[connections.mysql]
dialect = "mysql"
host = "localhost"
port = 3306
database = "xxx"
username = "xxx"
password = "xxx"
Copy the code below to your Streamlit app and run it. Make sure to adapt query to use the name of your table.
streamlit_app.py
import streamlit as st
conn = st.experimental_connection('mysql', type='sql')
df = conn.query('SELECT * from mytable;', ttl=600)
for row in df.itertuples():
st.write(f"{row.name} has a :{row.pet}:")
Instagram : / jinoy_varghese
Facebook : / 100006883817962
Website : https://cspsyco.blogspot.com/
YouTube : / @cspsyco
GitHub : https://github.com/Jinoy-Varghese
Join this channel to get access to perks:
/ @cspsyco
Laptop : https://www.flipkart.com/acer-swift-3...
Mic : https://www.flipkart.com/boya-by-m1-3...
Editing software : https://filmora.wondershare.net/
Watch video Connect Streamlit to MySQL | How to connect Streamlit to XAMPP MySQL Database | Part 3 online without registration, duration hours minute second in high quality. This video was added by user C S Psyco 20 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,132 once and liked it 31 people.