Could not find a valid gem 'mysql2-0.3.18.gem'

I have had this problem before, and the reason you are getting this method, is because you are trying to download from an https website.

My guess is you are trying to install all the gems in your gemfile and bundle install didn't work. It would give you a message like

bundler cannot continue. Please make sure gem install samplegem succeeds

Change the following line in your gemfile

source 'https://rubygems.org'

to

source 'http://rubygems.org'

and run bundle

alternatively, you could do the following

gem install mysql2 -s http://rubygems.org

Either way, you should be able to install the gem.