[英]Python/Masonite: pymysql.err.OperationalError (1045, "Access denied for user 'root'@'172.18.0.1' (using password: YES)")
Have attempted several tutorials but encounter error after error.尝试了几个教程,但在错误之后遇到错误。
Are you sure that you have permission to connect to your database using root from 172.18.0.1?您确定您有权使用 root 从 172.18.0.1 连接到您的数据库吗?
Try running SHOW GRANTS
on your database to see if you have the correct permissions set at a database level:尝试在您的数据库上运行
SHOW GRANTS
以查看您是否在数据库级别设置了正确的权限:
SHOW GRANTS FOR 'root';
You may also want to double check the .env
file in the root of your Masonite directory.您可能还需要仔细检查 Masonite 目录根目录中的
.env
文件。 This is where your environment is defined.这是您的环境定义的地方。
config/database.py
uses the environmental variables you define in .env
to configure access to your database (below is the default sqlite configuration). config/database.py
使用您在.env
中定义的环境变量来配置对数据库的访问(下面是默认的 sqlite 配置)。
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=masonite
DB_USERNAME=root
DB_PASSWORD=root
DB_LOG=True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.