我在实体框架上使用Mysql很久了。我已经在计算机上安装了当前服务器多年,没有出现任何问题(除了愚蠢的mysql nuget程序包永远无法工作...),但是突然出现了一个大问题。当我尝试通过实体框架向导连接以创建新模型时,出现以下错误消息
使用方法对用户“”的主机“”进行身份验证 'mysql-native-password'失败,并显示以下消息:用户的访问被拒绝 ''@'192.168.xxx.xxx'(使用密码:否)
我可以取消该消息并继续尝试创建新的连接,但是我随后收到了消息
字典中不存在给定的键
这对于我拥有的每个项目都会发生,即使是几天前运行良好的项目...
到底该如何解决?
更新
我已经完全卸载了mysql服务器和所有相关工具。然后重新安装它们。我现在一开始没有得到相同的错误。现在,我得到了
而不是“主机身份验证”错误缺少凭据中的服务器和用户
第二个错误我仍然和以前一样。所以看来这一定与Visual Studio有关,而不是与MySql有关……我现在可以尝试将其卸载。
更新2
好的。我现在已经重新安装了VS 2017,并且不再收到错误消息。但是,我现在回到“您的项目参考最新版本的实体框架错误”中。多年来,我经历了很多次,因为Oracle似乎完全无法提供有效的nuget软件包。因此,通常我会将dll从连接器安装复制到我的项目中,并对我的app.config进行一些更改,然后一切正常。但是,我不再能够使用此方法使一切正常工作。
我正在使用连接器8.0.12.0
这是我的app.config
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>