Newbie question : error when trying to use mysql instead of sqlite

hi,

I am trying to use mysql instead of sqlite in RoR.(using Aptana Studio)

  1. I added this line to the gem file
    gem ‘mysql2’
    2)ran bundle install
    3)made changes to the database.yml file
    default: &default
    adapter: mysql2
    pool: 5
    timeout: 5000
    encoding: utf8
    username: root
    password: ******
    host: 127.0.0.1
    port: 3306

development:
<<: *default
database: rails_development
(has test and production also)

  1. I type rails dbconsole / rails db on the terminal and get this error:
    Couldn’t find database client: mysql, mysql5, mysql.exe, mysql5.exe.
    Check your $PATH and try again.

  2. I added C:\Program Files\MySQL\MySQL Server 5.5\bin to the path

The error is still there.
What to do ?

Hi Rajeev,

thanks for the reply.

However I have already added the path (where mysql.exe lives) to PATH.
You can see point (6) in my first post.

The error is still there.

Also, when I try to migrate,
there is no output on the console.
I was successfully able to use migrate command when using sqlite.

Any help will be appreciated.

To be able to use “rails dbconsole”, mysql.exe needs to be in the
PATH.

Doing “rails dbconsole” is exactly the same as doing to MySQL Console
Client shortcut that should have been installed in your system.

If not, you can add the location of your MySQL installation (where
mysql.exe lives) to the PATH doing the following on a console:

SET PATH=%PATH%;C:\path\to\mysql

However, to avoid issues with spaces and such, I recommend you use the
MySQL Console Client shortcut.

Or Use Ubuntu In Short.

On Fri, May 1, 2015 at 3:56 PM, Manvi S. [email protected]
wrote:

timeout: 5000


.
For more options, visit https://groups.google.com/d/optout.


Rajeev Kannav Sharma
http://www.google.com/search?q=Rajeev+Kannav+Sharma&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

look at this, it might help.

Thanks

On Fri, May 1, 2015 at 4:23 PM, Manvi S. [email protected]
wrote:

there is no output on the console.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit

https://groups.google.com/d/msgid/rubyonrails-talk/1954fc86880204e40836d72fc714b16b%40ruby-forum.com

.
For more options, visit https://groups.google.com/d/optout.


Rajeev Kannav Sharma
http://www.google.com/search?q=Rajeev+Kannav+Sharma&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Hi Scott,

I am new to Ruby on Rails. But I have been coding with java for long
now.

I had MySql installed on my system from before. So I just did the above
steps.
It should have worked.

What am I doing wrong ?

On May 1, 2015, at 4:53 AM, Manvi S. [email protected] wrote:

However I have already added the path (where mysql.exe lives) to PATH.
You can see point (6) in my first post.

Did you install MySQL? Pardon if this is really basic, but your post
doesn’t actually say you installed MySQL, so it seems prudent to ask.

(The Ruby gem is just the adapter to allow Rails to access MySQL, it
doesn’t install MySQL for you.)

On May 1, 2015, at 7:20 AM, Manvi S. [email protected] wrote:

What am I doing wrong ?

Don’t know, because I don’t work with Windows—just wanted to make sure
you had MySQL.

One other thing, the log snippet you posted looked kind of like the
server was running and client was failing to connect—but I’m not sure.
Have you checked in Task Manager whether there is any pg process
running?

Hi,

I had similar issue. It turned out there were double quotes around MySQL
path in the %PATH% variable. While windows could recognize the path,
rails
couldn’t. Removing the quotes enables rials (and windows) to see the
path.
Error case: PATH = …;“C:\Program Files\MySQL\MySQL Server
5.5\bin”;…
Good case: PATH = …;C:\Program Files\MySQL\MySQL Server 5.5\bin;…

  1. Make sure you copy libmysql.dll into your ruby\bin directory.
  2. From a command prompt, type irb and enter.
  3. Type require ‘mysql2’ and hit enter.
    => Should return true

If it is not true ask the following:

Are you using a 32-bit version of Ruby and a 32-bit version of MySQL?
Or, a 64-bit?