我正在尝试将 Mac 上运行的 rails 应用程序连接到 Windows 7 机器上运行的 MySQL。它们都位于我家的同一网络上,我可以从 Mac ping 我的 Windows 机器。
尝试执行时rake db:create
出现此错误:
Host 'MACMINI-459400' is not allowed to connect to this MySQL server
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "database"=>"MySite_development", "pool"=>5, "username"=>"root", "password"=>"password", "host"=>"10.0.0.33"}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)
这是我当前的database.yml
内容
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: MySite_development
pool: 5
username: root
password: password
host: 10.0.0.33
我尝试关闭 Windows 防火墙,但没有用。我该如何让这两个连接起来?
答案1
您可以先尝试在 Windows 机器上运行以下 SQL
GRANT ALL ON *.* TO 'root'@'%'