Flask sqlalchemy:Mysql连接

2024-09-30 18:35:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下连接代码:

app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql:/uBrands:uBrands2018B@127.0.0.1/ubrands'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'some-secret-string'

日志上写着:

OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using passwod: YES)") (Background on this error at: http://sqlalche.me/e/e3q8)

我检查了用户名密码,数据库名称,一切正常,日志上也写着Access denied for user 'root'@'localhost',但是用户名不是root它的uBrands,为什么它说根@本地主机

注意:uBrands用户拥有对所有数据库的完全访问权限

有什么问题吗?在


Tags: 代码config数据库applocalhostforaccesssqlalchemy