Created import script but ruby complains about missing 'mysql2' gem


(Thomas Wilson) #1

We’re trying to run a custom import script for the LDU content management system. Unfortunately we have been unable to run it on our production box as ruby is complaining it cannot find mysql2.

We have ‘installed’ this by modifying the GemFile, then executing gem install mysql2 (after first installing libmysqlclient-dev). We did not see any errors in the installation logs for either of these.

We’re pulling our hair out here and can’t understand why mysql2 is not getting picked up. We’ve tried a bundle install too – alas, to no avail.

Is there something very obvious we’re missing here?


(Jens Maier) #2

You don’t need to modify the Gemfile if you’re going to install the gem manually with gem. On the other hand, if you’re running your importer through bundle exec, then only the gems currently mentioned in the Gemfile will be available.

In my experience (with the SMF2 importer), installing mysql2 through gem and running the import script without bundler (i.e. ruby smf2.rb <options> and not bundle exec ruby smf2.rb <options>) should work.


BBpress import issue - LoadError: cannot load such file -- mysql2
(Thomas Wilson) #3

This is what we ended up doing - seems to do the trick :smile: