当我访问“localhost:3000”时,我的浏览器显示“Waiting for localhost...”并且永远不会返回。
这是日志显示的内容:
Started GET "/" for 127.0.0.1 at Mon Sep 03 10:47:33 -0400 2012
Connecting to database specified by database.yml
我的database.yml内容:
development:
adapter: mysql2
encoding: utf8
database: chairsales_development
username: root
password: scrubbed
host: localhost
我可以使用此用户/密码从命令行正常连接到 MySql 5.5。 我已尝试将端口 3306 添加到配置 yml 文件,结果没有任何变化。
routes.rb 文件只包含这条 map 线:
root :to => "home#index"
我如何进一步诊断此问题并获取有关正在发生的事情的更多信息?有没有办法从 Rails 本身的日志中获取更详细的结果?
Windows 7 + MySQL 5.5 + Rails 3.2.8
MySQL根目录下my.ini文件的内容:
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
最佳答案
检查您的 /etc/mysql/my.cnf
并查看服务器是否绑定(bind)到 ip 地址或套接字或两者。当它绑定(bind)到套接字时,使用套接字绑定(bind)到服务器而不是使用网络。您可以通过传递 socket/path/to/socket
而不是 host
参数来执行此操作。
关于mysql - 等待本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12250437/