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)
5) 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.
6) I added C:\Program Files\MySQL\MySQL Server 5.5\bin to the path
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?
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?
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;…