我应该安装哪个驱动程序才能使用 powershell 运行 mysqlcommand?
我安装了 mysqlconnector [ODBC] 5.1.8 来运行 mysqlcommand,但出现此错误:
Cannot find type [MySql.Data.MySqlClient.MySqlConnection]: make sure the assembly containing this type is loaded
我应该安装哪个驱动程序 从 mysql 连接器站点 在 powershell 上运行此命令(或任何 MySql 命令)?
我的系统中安装了最新版本的 MySql,并且所有项目都使用 MySql 运行得很好。
I installed the mysqlconnector [ODBC] 5.1.8 for running my mysqlcommand, but I got this error:
Cannot find type [MySql.Data.MySqlClient.MySqlConnection]: make sure the assembly containing this type is loaded
Which driver should I install from the mysql connectors site to run this command (or any MySql command) on powershell?
I have the latest version of MySql installed in my system and all projects run with MySql very well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该安装 Connector/Net ,它会自行安装在 GAC 中,并且像任何其他 .Net 程序集一样可用。
然后你可以做例如
You should install the Connector/Net , it installs itself in the GAC, and is available like any other .Net assembly .
Then you can do e.g.
对于运行 Powershell 2.0 并使用 .NET 4 的任何收到此错误的人来说,过程略有不同。您仍然需要 .NET 连接器。
您需要在
$pshome
目录中创建一个配置文件,以允许 Powershell 与 .NET 4 程序集一起运行。 这个答案提供了一个适当的解决方案,并且评论中提供了一些针对 64 位计算机的有用信息。如果您在使用
LoadWithPartialName
时遇到问题...事实证明它自 Powershell 3.0 起已弃用 。此替代方案适用于 2 和 3,并且可能更容易排除故障,因为它是 cmdlet:其中 $path 是
MySql.Data.dll
所在的目录。For anyone receiving this error that is running Powershell 2.0 and using .NET 4, the procedure is slightly different. You will still need the .NET connector.
You will need to create a config file in the
$pshome
directory to allow Powershell to run with .NET 4 assemblies. This answer provides an appropriate solution to do so, and the comments have some helpful information for 64-bit machines.If you are experiencing trouble with
LoadWithPartialName
... turns out it is deprecated as of Powershell 3.0. This alternative will work in both 2 and 3, and may be a bit easier to troubleshoot since it is a cmdlet:Where $path is the directory that
MySql.Data.dll
is located.把这个文件MySql.Data.dll
在 powershell.exe 所在的目录中
put this file MySql.Data.dll
in directory where powershell.exe is residing