Ruby on rails-->Mysql2::Error Lost connection to MySQL server at 'waiting for initial communication packet', system error: 0
Hi I just started on Ruby on Rails. I try to launch my first 'HelloWorld' app using WebRick and MySQL 5.5, Windows XP
In firefox I can see the Rails standart page on "localhost:3000" but if I click on the link "about your apps environment" or try to see a pretty basic "hello world" page on localhost:3000/demo/inde开发者_高级运维x/ i get the error(after a minute or 2)
"Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.
Rails 3.0.7 MySQL 5.5 Gem 1.8.1 Ruby 1.9.2p180 Win XP 32 Tried both mysql and mysql2 gems on various versions. The database seems to work fine through the console. Tried also to connect with no password Using utf8 and stating that in the database.yml. tried https://github.com/ghazel/mysql2/commit/a9515ed75f3b7a7ce2813a364a0e7ede66394a41 tried to turn off firewalls completely
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: simple_db
pool: 5
username: simple
password:
host: localhost
port: 3000
Help me!!!! So frustrated.....
It looks like you're trying to connect your MySQL connection to the Mongrel socket, so that's not going to work very well, as your application will just call itself when trying to make a database call.
You should probably change that to the default port 3306, or just leave it out and let the configuration defaults come into play.
精彩评论