I needed for connecting to some remote MySQL host (with
rake db:create), but Rails always views so that it is local.
Database.yml which utilizes the next config:
defaults: &defaults encoding: unicode adapter: mysql username: <username> password: ************* port: 3306 host: <remote ip address> development: <<: *defaults database: <db name> test: &test <<: *defaults database: <db name> production: <<: *defaults database: <db name>
And try to understand this error when attempting anything around the database:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
The config works as lengthy when i make use of the local database (i.e. with no host/port part). Hooking up towards the remote MySQL server works fine using the given particulars.
Any applying for grants what's going wrong ?
The issue only happens with
rake:db:create, other tasks work - The mistake message really was badly misleading.
You may want to enable MySQL server to simply accept remote request (by binding to host's ip or all address format
0.0.0.0). Edit MySQL configuration file
my.cnf around the remote host. In Ubuntu, you'll find the file in
Change the need for bind-address:
bind-address = 0.0.0.0