Rake:db using mysql3

Hi, I have created a new app using “rails new biller -d mysql” command
and when I run “rake db:create”, it shows me an error saying “Could not
find gem ‘mysql2 (>=0) x86-mingw32’ in the gems available on this
machine.”

I have also noticed that I cannot run “rails s” also as it shows the
same error. I tried correcting this with:

“bundle install”
and
“gem install mysql2”

however, gem install “mysql3” works. If so then why doesn’t “rake
db:create” work. I Is there a way to make the same command for mysql3
becasue it says I have installed it.

My possible solutions:
Could this be that I deleted and downloaded a software I thought was
Workbench but it was actually mysql2? all over again not knowing I have
downloaded the wrong one?..
I installed “mysql-installer-web-community-5.6.20.0” which may be the
problem, but I dont know how to get mysql2 back. Im trying my hardest to
diagnose the problem can somebody please help me. Everything was fine
last night now I can’t even run “rails s”. I know i’m very close. PLEASE
HELP !:stuck_out_tongue:

The “2” or “3” after the gem refers to the version of the mysql rails
adapter (the gem), not the version of MySQL

What does your Gemfile actually say ?

also it might be that you’re on Windows, in which case you may have
special considerations building & compiling that Gem and/or MySQL
(beyond my expertise, but you might want to look for a set of
instructions on the internet specifically for setting up Rails+MySQL on
windows)

I have sorted the problem now Jason thanks for your help. You are right
I changed syntax from the Gemfile and database.ylm class from sqlite2 to
sqlite 3 and the files are created.

Now im typing “mysql u-root” and it does not work. Can you tell me how
to run “u -root” using windows which will take me to the MySQL monitor
in the command prompt. The guy in the tutorial uses mac and when I do it
“mysql” command is not recognized by windows.

On Wed, Sep 3, 2014 at 9:09 AM, Mohammed R. [email protected]
wrote:

I have sorted the problem now Jason thanks for your help. You are right
I changed syntax from the Gemfile and database.ylm class from sqlite2 to
sqlite 3 and the files are created.

Now im typing “mysql u-root” and it does not work.

Uh, well. Why do you care about that if you’re not using MySQL? Or
if you do want to use MySQL why are you specifying sqlite3 in your
database config?

They are two entirely different database engines.

Also, the command would be “mysql -u root” but first figure out what
database you’re actually trying to use.


Hassan S. ------------------------ [email protected]

twitter: @hassan

Yea sorry I’m not really familiar with MySQL on Windows. Probably a good
idea to get really solid with that first (maybe there’s a beginner
tutorial for?), can’t help you there.

Thanks a lot Jason you’ve helped as much as you could. And Hassan, I am
wanting to use MySQL instead of sqlite3 now. I have MySQL community
server installed. I cannot seem to install the gem I’m having problems
as it cannot recognise when I run gem install mysql2. however when I
download a version from the internet and specify that file by saying
(and I’m making numbers up here) “gem install v-4.1.2” it installs that
gem but in a binary version. It still however does not create rake
db:create ?

On Wed, Sep 3, 2014 at 6:39 PM, Mohammed R. [email protected]
wrote:

… wanting to use MySQL instead of sqlite3 now.

OK, great. Now, it sounds like your development environment isn’t
really set up properly, but that’s somewhat OS-specific and I have
no idea what to do with a Windows system at this point.

Hopefully someone can help with that.

Best of luck!

Hassan S. ------------------------ [email protected]

twitter: @hassan

Again, thank you for the great advice Hassan. I’m starting to get a
little comfortable with using mysql2, I fixed it with using a different
way of installing using Cmd now and have fixed all installation
problems.