问题描述:

I've been trying for a good while to get Rails to talk to MySQL. I was able to install the 'mysql2' gem (v0.2.7), create a new rails app defaulting to MySQL:

rails new mytest -d mysql

and bundle install everything.

However, when I run rake db:create, it simply hangs, no errors, no anything.

Running rake db:create --trace hangs at '** Execute db:create'.

My database.yml configuration:

development:

adapter: mysql2

encoding: utf8

reconnect: false

database: mytest_development

pool: 5

username: root

password: passwordforrootuser

host: localhost

Using:

  • Windows 7 (64-bit)
  • MySQL 5.5 Server (32-bit)
  • Ruby 1.9.2

Really at my wit's end. Help???

网友答案:

Might be worth a try, if you include:

  socket: /tmp/mysql.sock

My setup, normally looks like:

  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: foobar_development
  pool: 5
  username: root
  password: ***************
  socket: /tmp/mysql.sock
相关阅读:
Top