1

I'm having trouble connecting to a remote mysql db with mysql2 gem.

I get this error:

Host 'my_ip' is not allowed to connect to this MySQL server

My db.yml says:

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?

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!

2
  • Are you sure that, you're giving the right password? and make sure you've a space(" ") between key and value. For example: password: my_password instead of password:my_password. Commented May 19, 2012 at 6:02
  • I didn't work either.... Commented May 29, 2012 at 19:41

4 Answers 4

2

I solved this, pretty simple...

I just created a new user and password to the db with specific permissions instead of using root :)

Should have tried this from the beginning. I think this is the correct approach.

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

I did that :c. I can't access without problems from a mysql console. It's rails where the mistake is, but I don't know if it is my mistake or some gem incompatibility
0

development:

adapter: mysql2

encoding: utf8

reconnect: false

database: mystore_development

pool: 5

username: root

password:password

host: localhost

try this one surely it wil work...

3 Comments

some times they use tab instead of space please check that also
create database mystore_development in your db
How this differ of what I'm doing now? Besides setting the host to local. I have no problems with local db, my issue is with remote conections.
-1

change your host:localhost and try it again it will work

1 Comment

but the db I'm trying to use is on another server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.