简体   繁体   English

Windows 7上的MySQL gem安装错误

[英]MySQL gem install error on Windows 7

I am using Windows 7 and creating connection to MySQL2. 我正在使用Windows 7并创建与MySQL2的连接。 I need to install gem. 我需要安装gem。 I am following these steps. 我正在遵循这些步骤。 Could someone please review them: 有人可以评论一下:

  1. Add the following to the Gemfile: gem 'mysql2', '~> 0.3.15' 将以下内容添加到Gemfile:gem'mysql2 gem 'mysql2', '~> 0.3.15'

  2. Run the following in cmd : gem install mysql2 -v '0.3.15' cmd运行以下cmdgem install mysql2 -v '0.3.15'

  3. Go to the application using cmd and run this code: bundle install 使用cmd转到应用程序并运行以下代码: bundle install

When I perform step (3), I get the following error: 当我执行步骤(3)时,我收到以下错误:

An error occurred while installing mysql2 (0.3.15), and bundler cannot continue make sure that `gem install mysql2 -v "0.3.15" ' succeeds before bundling.. 安装mysql2(0.3.15)时发生错误,捆绑器无法继续确保`gem install mysql2 -v“0.3.15”'在捆绑之前成功。

My application resides on the D drive and I am using Windows 7. 我的应用程序驻留在D驱动器上,我使用的是Windows 7。

I have found a solution that works on Ubuntu. 我找到了一个适用于Ubuntu的解决方案。

My mistake was that had not installed the my-sql library before trying to connect. 我的错误是在尝试连接之前没有安装my-sql库。

Please follow these steps to do this. 请按照以下步骤执行此操作。 Run the following commands: 运行以下命令:

sudo apt-get install mysql-client libmysqlclient-dev

sudo gem install mysql2

Add the following to the gemfile 将以下内容添加到gemfile中

gem 'mysql2', '~> 0.3.15'

And then run: 然后运行:

bundle install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM