Ruby gem local installation method and add mysql. Gem in Windows

Source: Internet
Author: User
Problem:

Railsinstaller does not contain the MySQL gem by default.

After installing and configuring the rails environment using railsinstaller, you will find that you cannot use the gem update -- system or other updates or install the remote gem install-remote MySQL command, the following error is reported: GEM: remotefetcher: fetcherror. Too many connections are reset.
Some people on the Internet say that the address is broken down. (Snwrking: I played the gem update -- system very successfully, and there was no problem with the wall ~ )

Solution:

1. Add the-p parameter after the operation.Example:

?
gem update --system -p

Function of parameters: Option (-P, -- [no-] HTTP-proxy [url]) use an "HTTP proxy for remote operations", which means a proxy connection is used.

Install MySQL

?
gem install mysql -p

  

2. Use local installation:
Gem official address: http://rubygems.org/

Gem of mysql2: https://rubygems.org/gems/mysql/versions/2.8.1-x86-mingw32

List all installed gem commands:

gem query --local

Installation Method: Download The. Gem file, use CD to the directory where. Gem is located, and then execute the following command:

Gem install -- local filename. Gem

Or execute the command with the path name of the. Gem file.

Gem install -- local F:/Ruby/gem/filename. Gem

Note: This is an x86 version. All other versions of msyql or mysql2 are successfully installed. If a libmysql error is reported during the installation process, I just want to test this file under MySQL/bin to Ruby/bin.


3. Add other download resources:


First, view the gem running environment through gem Env.

?
gem env

Add two updated source addresses:

?
gem sources -a
http://gems.github.com   
gem sources -a

http://gems.rubyforge.org

  4. If the gem of MySQL is installed, an error is reported during use:

The libmysql. dll file that requires 6.0 compilation is downloaded. Yes: http://www.mysql.com/downloads/connector/c/

Download the package and put it in the ruby/bin directory. (Snwrking: Do not download the install version of Windows. Download the ZIP Archive version and decompress it in the lib directory .)

 

Reprinted Source: http://www.cnblogs.com/tambor/archive/2011/12/25/Ruby_gem_Windows_mysql.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.