How To Set up Ruby on Rails Mysql2 Gem on Home windows ten

If you cannot put in the MYSQL2 gem in Home windows, you need to have to obtain the C-Header documents from MYSQL. Compared with other gems, MYSQL2 requires direct linking into some of the native create documents offered by the library. Except you have MYSQL put in by now, it usually means you need to have to obtain – and reference – this library from the World wide web.

The problem is that because the MYSQL2 gem requires specified documents to enable it join to the World wide web, the gem utilizes these to at create. The error you are going to get will mention “Unsuccessful to create native extensions”. This usually means your Home windows system did not have the header documents expected for the gem to be put in accurately.

The way to solve this is to initial log onto the MYSQL internet site and look for “C-Connector”. This is mainly the “driver” for MYSQL, allowing for Home windows to call a quantity of pre-compiled capabilities to enable it communicate with regional or external MYSQL installations. The goal of this obtain is to be certain your computer system has the vital documents to put in the gem.

At the time you have discovered the MYSQL C-Connector file, you need to have to obtain it to your tough push. From this, unzip the file and position its contents on your tough push. You need to put it in a path which has no spaces, in any other case the installation reference will break. A path this sort of as C:/downloads/mysql-c-connector/documents will perform good. Make sure you note you do NOT need to have to put in this – only obtain the zipped archive, we can clear away it right after the gem has been put in.

If you have downloaded and placed the documents on your tough push, you need to have to then put in the gem yet again. To do this, you ought to load up CMD and kind the pursuing command “gem put in mysql2 –system=ruby — ‘–with-mysql-dir=”C:mysql-connector-path”‘”.

This command will reference the freshly put in MYSQL C-Connector library documents which Ruby requires to create the gem. If you’ve downloaded / put in it accurately, this ought to allow for Ruby to put in the expected documents etc. If successful, the cmd will describe the gem has been put in if not, it will very likely be that you have both downloaded the incorrect documents OR you have not bought a different vital library put in on your system.

Due to the fact Home windows comes with no external libraries, it is vital to put in any expected from the World wide web. This is a single of the good reasons most persons don’t like producing with Home windows – finally, if you’re able to obtain the right header documents, you ought to be good.

By Richard Peck

No Comments

Post A Comment