Monday, November 19, 2018

How To Install Ruby on Rails Mysql2 Gem on Windows 10

If you cannot install the MYSQL2 gem in Windows, you need to download the C-Header files from MYSQL. Unlike other gems, MYSQL2 requires direct linking into some of the native build files provided by the library. Unless you have MYSQL installed already, it means you need to download - and reference - this library from the Internet.

The problem is that since the MYSQL2 gem requires certain files to help it connect to the Internet, the gem uses these to at build. The error you'll receive will mention "Failed to build native extensions". This means your Windows system did not have the header files required for the gem to be installed correctly.

The way to resolve this is to first log onto the MYSQL website and look for "C-Connector". This is basically the "driver" for MYSQL, allowing Windows to call a number of pre-compiled functions to help it communicate with local or external MYSQL installations. The purpose of this download is to ensure your computer has the necessary files to install the gem.

Once you have found the MYSQL C-Connector file, you need to download it to your hard drive. From this, unzip the file and place its contents on your hard drive. You must put it in a path which has no spaces, otherwise the installation reference will break. A path such as C:/downloads/mysql-c-connector/files will work fine. Please note you do NOT need to install this - only download the zipped archive, we can remove it after the gem has been installed.

If you have downloaded and placed the files on your hard drive, you need to then install the gem again. To do this, you should load up CMD and type the following command "gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:mysql-connector-path"'".

This command will reference the newly installed MYSQL C-Connector library files which Ruby requires to build the gem. If you've downloaded / installed it correctly, this should allow Ruby to install the required files etc. If successful, the cmd will explain the gem has been installed; if not, it will likely be that you have either downloaded the incorrect files OR you have not got another necessary library installed on your system.

Since Windows comes with no external libraries, it's necessary to install any required from the Internet. This is one of the reasons most people don't like developing with Windows - ultimately, if you're able to download the correct header files, you should be fine.













Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : How To Install Ruby on Rails Mysql2 Gem on Windows 10

0 comments:

Post a Comment

  • Comments: 3 Key Steps To Begin Healing Your Money Story
  • What's a Good Business VoIP Service ProviderToday, small businesses are dependent on their technology as much as they are on their employees. If a system is down or a call cannot get through, transactions are not completed and money is lost. This can often be a problem with traditional…
  • Bartender Cover Letter Creation Help It's not uncommon for people in the bartending trade to do not know what exactly a cover letter is and why it is very good to write one? A resume cover letter is usually sent with a job application to supply background details, and also to…
  • Make Money Online Free And Easy - 3 Proven Methods! Want to make money online free and easy way? Here are the 3 proven methods for you! First, submit links to social bookmarking sites To make money online free and easy, you can offer to submit website links to social bookmarking sites for some…
  • Day-to-Day Business Card Marketing Whether you're a businessman or a freelance service provider, your business cards are going to play a big role in your success. The world is big out there but if you want to make good in whatever you do, you have to leave a mark. Yet before…
How To Install Ruby on Rails Mysql2 Gem on Windows 10
Important: This article is about the How To Install Ruby on Rails Mysql2 Gem on Windows 10, The best of How To Install Ruby on Rails Mysql2 Gem on Windows 10 inspiration updated regularly with new designs and info, and featuring the best How To Install Ruby on Rails Mysql2 Gem on Windows 10
Originally Answered: What are the best sites?
How To Install Ruby on Rails Mysql2 Gem on Windows 10 April 2025, We Always give correct and complete information about How To Install Ruby on Rails Mysql2 Gem on Windows 10, This document provides How To Install Ruby on Rails Mysql2 Gem on Windows 10 We want to improve the quality of content for all. By using information about the content you have received, those involved in providing info in April 2025.

Advertisement