Issues with Gem install MYSQL2

Source: Internet
Author: User

Run ' bundle install ' or ' gem install mysql2′ ' encountered the following error

> Gem install mysql2error:  Error Installing MYSQL2: The        ' mysql2 ' native gem requires installed build tools. Please update your PATH to include build tools or download the Devkitfrom ' Http://rubyinstaller.org/downloads ' and follow The Instructionsat ' Http://github.com/oneclick/rubyinstaller/wiki/Development-Kit '

or a

Error installing mysql2:ERROR:Failed to build gem native extension. C:/ruby192/bin/ruby.exe extconf.rb

Generally because the compiler is not installed and MySQL is not installed

The simplest solution:

If Rails version <3.1.0 installs MySQL 0.2.6. If the rails version is 3.1.*, you will need to install MySQL 0.3.*. Remember!

The default installation is Mysql2 0.3.7, this version changes more, you can install the old version of the gem, tested installation 0.2.6 will not error.

Gem Install mysql2-v 0.2.6

If you must install the latest version, you can refer to the following method.

Linux Workaround:

# sudo apt-get install Libmysql-ruby Libmysqlclient-dev

Windows is a hassle, install Devkit and MySQL first.

Install Devkit See my other article under Windows installation Devkit

Install MySQL will not elaborate, download and then double-click

After the above two steps are completed, install MYSQL2 like this

> Gem Install mysql2--'--with-mysql-dir= ' C:\Program files\mysql\mysql Server 5.5 "' #一定要注意引号, many friends forget the quotation marks, Cause installation Error updating installed gemsupdating mysql2temporarily enhancing PATH to include DevKit ... Building native extensions.  This could take a while ... Successfully installed Mysql2-0.3.2gems updated:mysql2installing ri documentation for mysql2-0.3.2 ... Enclosing class/module ' mMysql2 ' for class Client not knowninstalling RDoc documentation for mysql2-0.3.2 ... Enclosing class/module ' mMysql2 ' for class Client not known

This means that the installation was successful, but it may also be an error when used.

The final step: Copy the Libmysql.dll under the bin under the MySQL installation directory to the Ruby installation directory/lib.

Note: To ensure that the version is consistent, libmysql.dll do not download it from the Internet. Try copying from your own installation directory.

Report:

Sometimes start server times wrong

Install the MYSQL2 adapter: ' Gem install Activerecord-mysql2-adapter ' (no such file to load-Active_record/connec Tion_adapters/mysql2_adapter) (RuntimeError)

However, the gem will not be found when the gem is install Activerecord-mysql2-adapter.

This is generally because the installation of the MYSQL2 version is too new because MYSQL2 0.3. Version 2 starts to give up support for rails 3.0.*.

Solution:

Gem Uninstall Mysql2gem install Mysql2-v 0.2.7

Reference: http://rubyer.me/blog/138/

Issues with Gem install MYSQL2

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.