Home [FastAPI] MySQL 연동
Post
Cancel

[FastAPI] MySQL 연동

Peewee

python에서 mysql 접속을 위해서 peewee를 사용

1
2
# Python peewee.ImproperlyConfigured: MySQL driver not installed
pip install pymysql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from peewee import *

user = 'root'
password = '**'
db_name = '**'

conn = MySQLDatabase(
    db_name, user=user,
    password=password,
    host='localhost'
)

>>> conn.connect()
True
This post is licensed under CC BY 4.0 by the author.

[Airflow] Docker로 실행하기 Apple Silicon

[FastAPI] 시작하기