push Rails3 on Heroku. can not find mysql gem - mysql

i'm getting an error when pushing to heroku using rails 3. I'm on windows with ruby 1.8.7
Administrator#WIN-DQC3IH63U7C ~/nasha (master)
$ heroku rake db:migrate
rake aborted!
no such file to load -- mysql
/disk1/home/slugs/280561_9c64ba2_1741/mnt/Rakefile:4
(See full trace by running task with --trace)
(in /disk1/home/slugs/280561_9c64ba2_1741/mnt)

Heroku doesn't use the database you use for running your application locally.
Heroku uses PostgreSQL (http://docs.heroku.com/database)
Did you freeze Rails into vendor? This problem usually appears with Heroku when you freeze Rails. You must leave Heroku use it's own Rails based on your .gems file. You can read more about this here http://docs.heroku.com/gems#heroku-gem-manifest
If this is not the problem, did you follow the instructions regarding Heroku and Rails 3 applications? You can read about it here http://docs.heroku.com/rails3 Please notice that you must setup the Bamboo Stack for your Rails 3 application to work correctly.

You need have the mysql gem in your Gemfile
gem "mysql"

Related

"There was an error while trying to load the gem 'mysql2'. (Bundler::GemRequireError)" error shows up after redmine installation

I'm transferring redmine from our office's local server to an online server so that anyone who deals with bug management doesn't need to have a VPN account to access redmine.
So, We've chosen to use Bluehost.com because we saw their default Ruby version is 1.9.3(which works with redmine) while other hosts we've checked out were at 1.8.7
Okay I'm done establishing the backstory, now to the main storyline:
I'm trying for several days to install redmine on the server with no success.
The error I'm getting is this:
Error Message:
There was an error while trying to load the gem 'mysql2'.
(Bundler::GemRequireError)
Exception Class: PhusionPassenger::UnknownError
Here are some details:
Ruby version 1.9.3
Redmine version 3.2.2
Rails Version 4.2.5.2(installed as part of the bundle for redmine)
MySQL version 5.5.42
I've used a few guides on the web on how to install redmine on the server. one of whom was bluehost's guide:
https://my.bluehost.com/cgi/help/redmine
What I've tried after thoroughly searching StackOverflow:
I read that sometimes mysql2 gems have a problem and need to be reinstalled again after the bundle so I did gem install mysql2
I tried installing a specific version as well when someone here said that the mysql2 gem was working with bluehost on version 0.3.16 or other similar versions. Didn't work.
I even tried installing a local newer version of Ruby 2.3.1 but that didn't work either and only after I realized that the gems are not necessarily affected by the ruby version installed on the system.
I can't even use the test feature (like with WEBrick or Thin) because Bluehost wants you to own a dedicated server in order to open up special ports for you. We're using a shared host.
Anyway, after around 4 days of dealing with this I came to the conclusion that I need to seek out help. Sure I did learn practically the syntax of Ruby on Rails while dealing with this problem(which I was clueless on and have no knowledge in Ruby itself) but I need to get this done.
Does anyone have any insight on things I can try to get this working?
Here's a shot of the error:
Passenger Error
production.log data:
Migrating to InsertAllowedStatusesForNewIssues (20150725112753)
Migrating to CreateImports (20150730122707)
Migrating to CreateImportItems (20150730122735)
Migrating to ChangeTimeEntriesCommentsLimitTo1024 (20150921204850)
Migrating to ChangeWikiContentsCommentsLimitTo1024 (20150921210243)
Migrating to ChangeAttachmentsFilesizeLimitTo8 (20151020182334)
Migrating to FixCommaInUserFormatSettingValue (20151020182731)
Migrating to ChangeIssueCategoriesNameLimitTo60 (20151021184614)
Migrating to ChangeAuthSourcesFilterToText (20151021185456)
Migrating to ChangeUserPreferencesHideMailDefaultToTrue (20151021190616)
Migrating to AddTokensUpdatedOn (20151024082034)
Migrating to CreateCustomFieldEnumerations (20151025072118)
Migrating to AddProjectsDefaultVersionId (20151031095005)
in comparison, development.log is huge so I'll add a portion of it just to demonstrate the type of things written there.
I can access the cpanel and donwload the entire file if needed:
' ^[[1m^[[36m (0.2ms)^[[0m ^[[1mSHOW CREATE TABLE `wikis`^[[0m
^[[1m^[[35m (0.3ms)^[[0m SELECT fk.referenced_table_name as 'to_table'
,fk.referenced_column_name as 'primary_key'
,fk.column_name as 'column'
,fk.constraint_name as 'name'
FROM information_schema.key_column_usage fk
WHERE fk.referenced_column_name is not null
AND fk.table_schema = 'skredmin_redmine2'
AND fk.table_name = 'workflows'
Thanks for any insight!
Try 'bundle update mysql2'
I'm new to the server side of redmine but I experienced this issue when we updated mysql on our server. This did the trick for me, hope it helps.
I had to downgrade my version of mysql2 gem in the gemfile:
gem 'mysql2', '~> 0.3.18'
Then using a bundle update to downgrade the version.

Ruby (Rack) application could not be started - mysql library error

Bluehost just upgraded their MySql version and broke my application.
I now get "Ruby (Rack) application could not be started" and this specific file load error:
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /home4/mychairs/ruby/gems/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
Notice the super long root-based path.
Running
bundle install
via SSH and then
bundle show mysql2
I am told that I am using this library:
/home4/mychairs/ruby/gems/gems/mysql2-0.3.11
I cannot tell where the abnormal path is being generated.
Remove the mysql gem manually and reinstall it via 'bundle install'. Bundler has no idea the underlying MySQL lib has changed, it just knows that the gem is there.

Heroku error: Please install the postgresql adapter but I'm using mysql, so why am I seeing this error?

Please install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is not part of the bundle. Add it to Gemfile.)
So I followed the instructions here: How to handle Ruby on Rails error: "Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'"
First of all, that doesn't fix my issue (causes other errors that I'd need to debug), but regardless, why should I have to install the PG interface for ruby exactly? I'm on mysql!
Edit: I've been told Heroku doesn't support MySQL. Was this a recent change? I was using mysql just about 3 months back for my Heroku site without any issues at all.
I don't want to presume anything but if you were able to work with heroku before, you probably had something like this in your Gemfile:
group :production do
gem 'pg'
....
end
group :development do
gem 'rspec-rails'
gem 'sqlite3'
....
end
This would ensure that rails is using mysql (or sqlite3 if you copy the example verbatim) in the development environment and postgres ('pg') on the production environment hosted by heroku. Give this a shot and see if it solves your problem. I hope it does.

Segfault when I rake (Ruby on Rails)

EDIT: Here's the solution (in case the thread linked to below disappears):
Install ruby 1.8.6 (down from 1.8.7)
gem install rails -v=2.3.8 (same as before)
gem install mysql (version 2.8.1, same as before)
Download libmysql.dll from http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll and deposit it in Ruby186/bin. (Before, I had copied over the libmysql.dll file from Mysql/bin.)
When I attempt rake db:migrate with the database.yml file configured for mysql (not sqlite3) I get the following segfault error:
C:/Ruby187/lib/ruby/1.8/benchmark.rb:306: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32]
I have already looked at this thread: Ruby on Rails Rake Error and don't see any help there.*** It appears that my rails app is configured correctly because when I run rake db:create, rails successfully creates the mysql schema dictated for the development environment in database.yml (or returns a "schema already exists" message).
I'd guess I had mysql configured incorrectly, but the fact that rake db:create works on it makes me think otherwise. I have successfully set up rails and mysql (working together) on three other machines; I don't know what the problem is on this one.
Ruby v. 1.8.7 -
Rails v. 2.3.8 -
Mysql v. 5.1.54
***The user who posted that thread indicated that he solved the problem thanks to a post on aptana. The link to that post, however, points to the home page, so the answer thread appears to have either been moved or removed.
Does this describe the solution as well? http://rubyat.com/blog/2010/06/rails-2-3-8-segmentation-fault/
I found that the last step, using the instantrails dll, solved my problem on Win 7 x64 without my having to change ruby or rails versions.
ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
rails -v
Rails 3.2.0
gem search mysql
mysql (2.8.1 x86-mingw32)

MySQL bindings for Rails 2.3.5 on Mac OS X 10.5.8

I have a rails environment which I set-up with macports. I recently updated macports which seems to have had the side effect of breaking rails. When I try to boot a rails server I get:
$ ./script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle: dlopen(/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle, 9): Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient.15.dylib (LoadError)
Referenced from: /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
Reason: image not found - /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9/mysql.bundle
I've tried reinstalling the mysql gem many times using various configurations I've found around the web but nothing seems to help. Also, when I try to use rake I get:
rake db:migrate
Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Pleasegem update --systemand try again.
Even though:
gem --version
1.3.6
What's going on here?
It seems the problem was that I had rails installed under macports, and also as a gem. I uninstalled all the rails components from macports and just stuck with the gems version and it seems to have made the MySQL problem go away.