Error “…cannot load such file — mysql2/2.0/mysql2 (LoadError)”. On Windows XP with Ruby 2.0.0

Had the absolutely same issue on Windows 7 x64 with Ruby 2.0.0 and DevKit 4.7. The following steps helped me. gem uninstall mysql2 Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip Extract it to C:\connector-6.0.2 gem install mysql2 –platform=ruby — ‘–with-mysql-lib=”C:\connector-6.0.2\lib” –with-mysql-include=”C:\connector-6.0.2\include” –with-mysql-dir=”C:\connector-6.0.2″‘ Or even shorter: gem install mysql2 –platform=ruby — –with-opt-dir=”C:\connector-6.0.2″

Ruby gem mysql2 install failing [duplicate]

Ubuntu: sudo apt-get install libmysqlclient-dev #(mysql development headers) sudo gem install mysql2 — –with-mysql-dir=/etc/mysql/ That’s it! Result: Building native extensions. This could take a while… Successfully installed mysql2-0.2.6 1 gem installed Installing ri documentation for mysql2-0.2.6… Enclosing class/module ‘mMysql2’ for class Result not known Enclosing class/module ‘mMysql2’ for class Client not known Installing RDoc documentation … Read more

ld: library not found for -lzstd while bundle install for mysql2 gem Ruby on macOS Big Sur 11.4 Apple M1

Step 1: confirm you have both openssl and MySQL installed via brew brew install mysql brew install openssl or if you have previous version of openssl try brew reinstall openssl@3 Step 2: Run this on your Rails app to make sure you can get through bundler: gem install mysql2 -v ‘0.5.3’ — –with-opt-dir=$(brew –prefix openssl) … Read more

rails server fails to start with mysql2 using rvm & ruby 1.9.2-p0 on OSX 10.6.5

The problem comes from the mysql2 gem missing the dynamic library from MySQL. A cleaner solution than install_name_tool … would need to update your DYLD_LIBRARY_PATH to add MySQL libs to it. To do so, update your ~/.bash_profile to add the MySQL library folder : export DYLD_LIBRARY_PATH=”/usr/local/mysql/lib:$DYLD_LIBRARY_PATH” Note: You might want to update the MySQL location … Read more

Ruby MYSQL2 gem installation on windows 7

EDIT 30/09/2014 When this answer was posted the 64 bit rails installer wasn’t the recommended version – it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed. Amazingly … Read more

Error installing mysql2: Failed to build gem native extension

On Ubuntu/Debian and other distributions using aptitude: sudo apt-get install libmysql-ruby libmysqlclient-dev Package libmysql-ruby has been phased out and replaced by ruby-mysql. This is where I found the solution. If the above command doesn’t work because libmysql-ruby cannot be found, the following should be sufficient: sudo apt-get install libmysqlclient-dev On Red Hat/CentOS and other distributions … Read more