I'm having trouble connecting to a remote mysql db with mysql2 gem.
我无法使用mysql2 gem连接到远程mysql数据库。
I get this error:
我收到此错误:
Host 'my_ip' is not allowed to connect to this MySQL server
My db.yml says:
我的db.yml说:
remote_development:
adapter: mysql2
reconnect: false
host: host_ip
encoding: utf8
database: host_db
pool: 5
username: root
password:
And when I try to connect via my sql or telnet I have no problems at all. I've double and triple checked the data con my yml, but can't get through this. Any idea?
当我尝试通过我的sql或telnet连接时,我没有任何问题。我已经对我的yml数据进行了两次和三次检查,但无法完成此操作。任何想法?
Btw I'm using Rails 3.2.3, Ruby 1.9.3, and tried mysql2 v 0.2.18 and 0.3.11 ... pls HELP!
顺便说一句,我正在使用Rails 3.2.3,Ruby 1.9.3,并尝试了mysql2 v 0.2.18和0.3.11 ...请帮助!
4 个解决方案
#1
2
I solved this, pretty simple...
我解决了这个问题,非常简单......
I just created a new user and password to the db with specific permissions instead of using root :)
我刚刚使用特定权限而不是使用root创建了一个新的用户和密码到数据库:)
Should have tried this from the beginning. I think this is the correct approach.
应该从一开始就试过这个。我认为这是正确的方法。
#2
0
This seems to be a MySQL error message. I think the problem may be the user account that you are using. It should be set up with the 'username'@'%'
format when setting it up. The percent sign means all ip addresses. You should then flush privileges
on the server to make the account available.
这似乎是MySQL错误消息。我认为问题可能是您正在使用的用户帐户。设置时应使用'username'@'%'格式进行设置。百分号表示所有IP地址。然后,您应该刷新服务器上的权限以使该帐户可用。
#3
0
development:
发展:
adapter: mysql2
适配器:mysql2
encoding: utf8
编码:utf8
reconnect: false
重新连接:false
database: mystore_development
数据库:mystore_development
pool: 5
游泳池:5
username: root
用户名:root
password:password
密码:密码
host: localhost
host:localhost
try this one surely it wil work...
试试这个肯定会工作......
#4
-1
change your host:localhost
and try it again it will work
更改您的主机:localhost并再次尝试它将工作
#1
2
I solved this, pretty simple...
我解决了这个问题,非常简单......
I just created a new user and password to the db with specific permissions instead of using root :)
我刚刚使用特定权限而不是使用root创建了一个新的用户和密码到数据库:)
Should have tried this from the beginning. I think this is the correct approach.
应该从一开始就试过这个。我认为这是正确的方法。
#2
0
This seems to be a MySQL error message. I think the problem may be the user account that you are using. It should be set up with the 'username'@'%'
format when setting it up. The percent sign means all ip addresses. You should then flush privileges
on the server to make the account available.
这似乎是MySQL错误消息。我认为问题可能是您正在使用的用户帐户。设置时应使用'username'@'%'格式进行设置。百分号表示所有IP地址。然后,您应该刷新服务器上的权限以使该帐户可用。
#3
0
development:
发展:
adapter: mysql2
适配器:mysql2
encoding: utf8
编码:utf8
reconnect: false
重新连接:false
database: mystore_development
数据库:mystore_development
pool: 5
游泳池:5
username: root
用户名:root
password:password
密码:密码
host: localhost
host:localhost
try this one surely it wil work...
试试这个肯定会工作......
#4
-1
change your host:localhost
and try it again it will work
更改您的主机:localhost并再次尝试它将工作