Problems connecting to remote MySQL host with Rails -


i wanted connect remote mysql host (with rake db:create), rails considers local. database.yml uses following 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 error when trying on database:

error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) 

the config works long use local database (i.e. without host/port part). connecting remote mysql server works fine given details.

any ideas on going wrong ?

edit: problem occurs rake:db:create, other tasks work - error message badly misleading.

you may need enable mysql server accept remote request (by binding host's ip address or address format 0.0.0.0). edit mysql configuration file my.cnf on remote host. in ubuntu, can find file in /etc/mysql/my.cnf

change value of bind-address:

bind-address            = 0.0.0.0 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -