My installation
- Ubuntu 10.10
- Rails 3
- gem = sqlite3 and sqlite3-ruby
- gem = mysql2
Now I created a application called mytestapp, using
rails new mytestapp
As usual with rails 3 it defaults to using sqlite3 database. Now I wanted to change the database for mytestapp so that it uses MySql database.
I made changes here
- database.yml
- gemfile - I added gem 'mysql2' and removed gem 'sqlite3'
My new database.yml looked something like this
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: mytestapp_development
pool: 5
username: mytestapp
password: hacked
socket: /var/run/mysqld/mysqld.sock
Now I goto localhost:3000 and click on the about application's development environment I get the following error
ActiveRecord::ConnectionNotEstablished
MySql user mytestapp has proper permissions for the database.
Infact when I create a new rails app using the following
rails new anotherapp -d mysql
It works great. What can be missing here.