MySQL Delphi XE5 FireDAC 错误:无法加载供应商库 [libmysql.dll 或 libmysqld.dll]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21857209/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Delphi XE5 FireDAC Error: Cannot load vendor library [libmysql.dll or libmysqld.dll]
提问by aurallion
I'm using Delphi XE5 on Windows 7 64bit and just trying FireDAC component. I'm using one TFDConnection component to connect to local MySQL database (v5.6.15).
我在 Windows 7 64 位上使用 Delphi XE5,只是在尝试 FireDAC 组件。我正在使用一个 TFDConnection 组件连接到本地 MySQL 数据库 (v5.6.15)。
I already put the libmysql.dll (32bit v5.6.15) into my Project folder, the EXE folder and C:\Windows\System32 folder (which is PATH location), but when I tried to Connect from the IDE, I encountered an error:
我已经将 libmysql.dll (32bit v5.6.15) 放入我的 Project 文件夹、EXE 文件夹和 C:\Windows\System32 文件夹(这是 PATH 位置),但是当我尝试从 IDE 连接时,我遇到了错误:
Cannot load vendor library [libmysql.dll or libmysqld.dll]. THe system cannot find the file spcified. Hint: check it is in the PATH or application EXE directories, and has x86 bitness..
无法加载供应商库 [libmysql.dll 或 libmysqld.dll]。系统找不到指定的文件。提示:检查它是否在 PATH 或应用程序 EXE 目录中,并且具有 x86 位..
I also tried to put the libmysql.dll (64bit v5.6.15) to all those three folders, but still encounter the same error.
我也尝试将 libmysql.dll (64bit v5.6.15) 放到所有这三个文件夹中,但仍然遇到相同的错误。
Do I miss something to make it connected? Thank you for the help.
我错过了什么让它连接起来吗?感谢您的帮助。
采纳答案by aurallion
Try to set TFDPhysMySQLDriverLink.VendorLib property to the full path of libmysql.dll and see what the message you will get or the app will connect
尝试将 TFDPhysMySQLDriverLink.VendorLib 属性设置为 libmysql.dll 的完整路径,然后查看您将收到的消息或应用程序将连接的内容
Tried the solution based on da-softcomment above, and It works well. Thanks
根据上面的da-soft评论尝试了解决方案,并且效果很好。谢谢
回答by Craig Chapman
Don't copy dll files to the bin directory as suggested by some others answers. This could potentially interfere with the copy protection mechanism and cause your IDE to vanish without warning, and could upset the license.
不要按照其他一些答案的建议将 dll 文件复制到 bin 目录。这可能会干扰复制保护机制并导致您的 IDE 在没有警告的情况下消失,并可能破坏许可证。
Copy the dll files to another location on your path which the IDE (and/or your app) can see.
将 dll 文件复制到 IDE(和/或您的应用程序)可以看到的路径上的另一个位置。
回答by NoName
- Download from: https://dev.mysql.com/downloads/connector/c/
- libmysql.dll copy to: C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\bin
- 下载地址:https: //dev.mysql.com/downloads/connector/c/
- libmysql.dll 复制到:C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\bin
回答by k.bon
xampp
xampp
C:\xampp\mysql\lib\libmysql.dll
C:\xampp\mysql\lib\libmysqld.dll
COPY TO
复制到
C:\Program Files (x86)\Embarcadero\RAD Studio.0\bin
回答by Abu Dzarr
Had this same problem trying to connect FireDAC to mysql on Berlin 10.1
在柏林 10.1 上尝试将 FireDAC 连接到 mysql 时遇到了同样的问题
Mysql managed by WAMPserver64 on a 64-bit Window 10 machine. So I have libmysql.dll {64-bit} located in my WAMP mysql bin folder. Downloaded mysql-connector-c-6.1.6-win32.zip from https://dev.mysql.com/downloads/connector/c/and put libmysql.dll {32-bit} in SysWOW64, as suggested by NoName
Mysql 由 WAMPserver64 在 64 位 Window 10 机器上管理。所以我在我的 WAMP mysql bin 文件夹中有 libmysql.dll {64-bit}。 按照 NoName 的建议,从https://dev.mysql.com/downloads/connector/c/下载 mysql-connector-c-6.1.6-win32.zip并将 libmysql.dll {32-bit} 放入 SysWOW64
Added the following lines into FDDrivers.ini
将以下行添加到 FDDrivers.ini
[MySQL]
BaseDriverID=MySQL
VendorLibWin32=c:\Windows\SysWOW64\libmysql.dll
VendorLibWin64=c:\wamp64\bin\mysql\mysql5.7.14\lib\libmysql.dll
回答by CAnder
Also experienced the problems described above with Seattle, connecting to a local and remote 64-bit version of MySQL.
在西雅图也遇到了上面描述的问题,连接到本地和远程 64 位版本的 MySQL。
Neither placing the 32-bit version of libmysql.dll (obtained from same source as NoName above) in the exe directory or setting the VendorLib property worked.
将 32 位版本的 libmysql.dll(从与上面的 NoName 相同的来源获得)放在 exe 目录中或设置 VendorLib 属性都不起作用。
However, due to an exception thrown on a Windows 7 machine that advised it was unable to load VCRuntime140.dll, I found a copy and placed it in the same directory as libmysql.dll, and this worked.
但是,由于在 Windows 7 机器上抛出的异常提示它无法加载 VCRuntime140.dll,我找到了一个副本并将其放置在与 libmysql.dll 相同的目录中,这奏效了。
All I could find about VCRuntime140 online, is it is used by MS Visual Studio. Copies found on machines I've performed a search on, have been in directories belonging to DropBox (this is the one I copied) and OneDrive. I could not find an online resource that satisfactorily explained why it worked or why it would be needed.
我能在网上找到关于 VCRuntime140 的所有信息,它是由 MS Visual Studio 使用的。在我执行过搜索的机器上找到的副本位于属于 DropBox(这是我复制的那个)和 OneDrive 的目录中。我找不到可以令人满意地解释为什么它有效或为什么需要它的在线资源。