【问题标题】:C# and EF Can not connect to remote MySql Server but MySql workbench connectsC# 和 EF 无法连接到远程 MySql 服务器但 MySql 工作台连接
【发布时间】:2013-04-11 21:05:32
【问题描述】:

我在远程托管服务提供商上有这个 Mysql 数据库。我安装了 MySql 工作台并提供以下信息:

server,
username,
pw

连接正常,但是当我尝试使用 visualstudio 时出现此错误

我正在使用来自 MySql 网站的 MySql 连接器。此外,当尝试连接 EntityFramework 中的以下连接字符串时

Server=tango.rdb.superhosting.bg;Database=ulprojec_weatheronmars;Uid=ulpro_georgi_it;Pwd=password;

我收到以下错误

An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.

我仍然可以通过 MySql 工作台执行 LINQ 等。

【问题讨论】:

  • 老兄,如果你的截图是正确的,那是因为你使用Microsoft SQL Server驱动连接MySql

标签: c# mysql .net entity-framework


【解决方案1】:

根据您的 Visual Studio 屏幕截图,您正在尝试连接 Sql Server 驱动程序。您应该使用 MySql 驱动程序。我的猜测是您对 Entity Framework 也是如此。

免责声明:我没有使用过 MySql,所以我不知道从哪里获得驱动程序。我相信 Google 会知道的。

【讨论】:

  • 该死的我很愚蠢,我只是忽略了底线是 MySql 数据库提供程序,我安装了它。我得睡一会儿;d,无论如何,谢谢你。
  • @georgi-it - 如果这解决了您的问题,请不要忘记接受答案。
猜你喜欢
  • 1970-01-01
  • 2017-06-26
  • 2016-12-25
  • 1970-01-01
  • 2019-05-13
  • 2014-03-04
  • 2016-10-21
  • 1970-01-01
相关资源
最近更新 更多