I'm trying to install ROR with a MySQL backend on a Windows 7 x64 box but they are not working together. When I did this before several months ago, it was just a mysql install and a bundle command but not this time.
I've installed MySQL 5.1 32 bit on a path with no spaces and configured the server. I had to install the mysql2 gem using the command line arguments to specify the mysql instance path to get the gem to install. However, rake db:create fails with a Can't connect to MySQL server on 'localhost' (10061)
error.
I have verifed that mysql is running on the specified port. mysql, mysqladmin, and telnet localhost 3306
all work as normal. I have a firewall exception for port 3306 and it works fine. I've also turned the firewall off and it makes no difference.
I've spent hours going though google and trying many possibilities without success. Most of the documentation I have found relates to issues where mysql is not running / running on a pipe but this is not my problem.
database.yml excerpt:
common: &common
adapter: mysql2
encoding: utf8
reconnect: false
pool: 5
username: root
password: root
#host: 127.0.0.1
host: localhost
port: 3307
development:
<<: *common
database: project_dev
Any ideas how to fix this?
From the mysql2 page on GitHub , you may have a missing configuration line in your Gemfile, depending on your version of ActiveRecord.
NOTE: as of 0.3.0, and ActiveRecord 3.1 - the ActiveRecord adapter has been pulled out of this gem and into ActiveRecord itself. If you need to use mysql2 with Rails versions < 3.1 make sure and specify gem "mysql2", "~> 0.2.7" in your Gemfile
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.