Question

I'm trying to connect my rails app running on my Mac to MySQL running on my Windows 7 machine. They are both on the same network at my house, and I can ping my Windows machine from my Mac.

Trying to execute rake db:create I get this error:

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)

This is my current database.yml contents

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: MySite_development
  pool: 5
  username: root
  password: password
  host: 10.0.0.33

I've tried turning off Windows firewall but didn't work. How can I get these two to connect?

Was it helpful?

Solution

you have to create a user on windows 7 machine for external access here is the syntax if you want to use it with root user:

grant all on dbname.* to 'root'@'MACMINI-459400' identified by 'password' with grant option;

Note: change values of "dbname" to you database name, if you want to grant all databases use "*" without quotes, also change "root" to required username and "password" to the required password.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top