ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3)
From https://github.com/brianmario/mysql2/issues/8 just copied this in the console sudo apt-get install mysql-client libmysqlclient-dev and worked!!
From https://github.com/brianmario/mysql2/issues/8 just copied this in the console sudo apt-get install mysql-client libmysqlclient-dev and worked!!
This is just 2 different APIs written by regular people. Difference is in syntax of commands and maybe in performance, just install both, make your own tests for your goals and choose one you think is more suitable for you. Here is a comparison by NPMCompare:
Uninstalling and reinstalling the gem will often solve this issue with no need to download and move files around by hand. From your rails app directory: > gem uninstall mysql2 You have requested to uninstall the gem: mysql2-0.3.11 database_cleaner-0.9.1 depends on [mysql2 (>= 0)] If you remove this gems, one or more dependencies will not … Read more
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
You can pass a string that is the join-sql too. eg joins(“LEFT JOIN StudentEnrollment se ON c.id = se.course_id”) Though I’d use rails-standard table naming for clarity: joins(“LEFT JOIN student_enrollments ON courses.id = student_enrollments.course_id”)
For anybody still experiencing the issue: When you install openssl via brew, you should get the following message: Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you’ll need … Read more
If you have this error when upgrading to rails 4.2.4 (also with rails 4.1.5) try using this version of mysql2: gem ‘mysql2’, ‘~> 0.3.18′ Apparently mysql2 isn’t still compatible with newer version of rails because rails 4.2.4 is pretty new as the time of answering this question by me 8 September 2015 so use the … Read more
Just do: gem ‘mysql2’, ‘~> 0.3.18’ this gem works with rails version 4.x.x if install gem ‘mysql2’, ‘~> 0.4.0’ it produces gem load error and causes compatibility issues
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