Rails 服务器不工作(LoadErrror mysql2)Windows

Rails Server not Working (LoadErrror mysql2) Windows

我正在尝试 运行 rails 服务器命令,但它显示 mysql2 加载错误。我会把我的错误日志放在这里

我找了很多地方。 我尝试使用粘贴在 ruby/bin 中的连接器 c "libmysql.dll" 文件使用 "gem install mysql2 --ruby=platform" 命令从我的包本身安装,但没有用。

事实上,早在我进行 JDBC 连接时,我的系统上就安装了 MySQL。它的 SQL 服务器版本 5.0- 是那个版本导致了这个错误吗?或者我需要从我的系统中卸载 MySQL 并安装最新版本! 我的疑问是 MySQL Server 5.0 是如何连接到 Rails 的,因为我不知道,因为在安装时我使用 Connector C 6.1 从 mysql2 安装命令提示符!

我试过了

我也试过了Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0 但是我得到了同样的错误。

我想我已经提供了有关版本和我所做的所有细节! 我试过这样做 50 次,但没有任何进展!我希望我能解决我的问题!谢谢!

我没有使用 windows。但似乎与这样的帖子重复 (Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0)

以下说明可以为您提供帮助。

gem uninstall mysql2

http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip

下载最后一个 MySQL 连接器

解压到C:\connector-6.0.2

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-
6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-
dir="C:\connector-6.0.2"'

或更短:

gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"