操作 MySQL 数据库使用 mysql-connector-python 库
- 安装mysql-connector-python
pip install mysql-connector-python
- 代码编写
在原来代码基础上添加数据库连接配置
from typing import Union
from fastapi import FastAPI
app = FastAPI(
标签:python,fastapi,数据库,mysql,connector,FastAPI,import
From: https://blog.csdn.net/weixin_42551921/article/details/141336625