2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

解决nim db_mysql could not load: libmysql.dll的问题

Last updated at Posted at 2018-01-15

nim中使用db_mysql 操作数据库的代码看起来很简单:

nimmysql.nim
import db_mysql

let db = open("localhost", "root", "root", "xxx")
echo db.getAllRows(sql"SELECT * FROM `xxx`.`xi_messages`")
db.close()

但是编译是提示:
could not load: libmysql.dll
我很绝望。

我的环境是windows 7 x64 & nim 0.17.2 x64。我用Everything搜索了一下libmysql.dll。我电脑上很多工具都带有libmysql.dll 这个文件,并且工作良好。

于是我随手复制了一个libmysql.dll 到 nimmysql.nim所在的目录。编译和运行EXE,仍然could not load: libmysql.dll。

我很绝望。

我搜索相关内容找到这个帖子:
https://stackoverflow.com/questions/37834804/cannot-load-vendor-library-libmysql-dll-or-libmysqld-dll

我不可置信地照这个回答去尝试解决,
先上mysql 网站下载 mysql zip包,https://dev.mysql.com/downloads/mysql/

我的系统和Nim 是x64的。所以我下载x64 的mysql , 解压后找到libmysql.dll,复制到我的代码的目录下。
然后问题解决了。。。

2018-01-15 13:31:14 codegay

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?