首页 > 解决方案 > 在 MySql 数据库上搭建脚手架时访问被拒绝

问题描述

我想在我的 .Net Core 项目上使用实体框架核心来连接到 mysql db。当我尝试搭建脚手架时出现访问被拒绝错误。

Authentication to host 'MyHost.com' for user 'root' using method 'caching_sha2_password' failed with message: Access denied for user 'root'@'MYIP' (using password: YES)

我正在使用这个命令

Scaffold-DbContext "server=MyHost.com;port=9999;user=root;password=Myunbreakablepsw;database=MyDb" MySql.Data.EntityFrameworkCore -OutputDir dbContext -f

谢谢

标签: c#mysqlasp.net-core

解决方案


您的密码中可能包含有问题的字符。对我来说是'$'。这在正常使用中很好,但 Scaffold-DbContext 命令会阻塞它。更改您的密码。


推荐阅读