cargo install diesel_cli
报错 could not find native static library mysqlclient
官网提示 This means you are missing the client library needed for a database backend – mysqlclient in this case. You can resolve this issue by either installing the library (using the usual way to do this depending on your operating system)
后参考这个说明 https://blog.csdn.net/wangmarkqi/article/details/104618575
本机已安装mysql8.0 环境变量中指定了 相对路径\MySQL\Connector C++ 8.0\lib64\vs14 依旧失败
之后下了mysql-connector-c-6.1.11-winx64 环境变量中指定路径 相对路径\MySQL\mysql-connector-c-6.1.11-winx64\lib\vs14 依旧失败
评论区
写评论是的,不仅要下载 mysql-connector-c-6.1.11-winx64,还要设置这个环境变量。
--
👇
yar999: 设置环境变量 MYSQLCLIENT_LIB_DIR 试试看
MYSQLCLIENT_LIB_DIR 为 libmysql.dll所在的目录
例如: MYSQLCLIENT_LIB_DIR=D:\dev\mysql\mysqlcc\lib
在编译、测试时还是要set RUSTFLAGS=-LE:\,因为其中的依赖diesel = { version = "1.0.0", features = ["mysql"] }需要它。 对以下内容的回复:
1 下载https://cdn.mysql.com/archives/mysql-connector-c/mysql-connector-c-6.1.11-winx64.zip 2 只解压出mysql-connector-c-6.1.11-winx64.zip\mysql-connector-c-6.1.11-winx64\lib\vs14\mysqlclient.lib这一个文件,放入E:(举例) 3 set MYSQLCLIENT_LIB_DIR=E:
再安装就行了。其它目录下的mysqlclient.lib可能不行。 对以下内容的回复:
设置环境变量 MYSQLCLIENT_LIB_DIR 试试看
MYSQLCLIENT_LIB_DIR 为 libmysql.dll所在的目录
例如: MYSQLCLIENT_LIB_DIR=D:\dev\mysql\mysqlcc\lib