I'm attempting to use Sequel.connect to connect to a remote MySQL database
hosted on an AWS EC2 instance. I need to migrate data from this database to
a local postgres database.
Here's my code snippet:
```
puts "Connecting to OLD database"
OLD_DB = Sequel.connect(:adapter => 'mysql',
:host =>
'<aws_ec2_public_ip>',
:database => '<database>',
:user => '<user>',
:password => '<password>',
:max_connections => 16)
puts "OLD_DB #{OLD_DB}"
OLD_DB[:users].order(:id).each do |user|
puts "#{user}"
end
```
Here's I see on the command line:
```
OLD_DB #<Sequel::MySQL::Database:0x007f9554927840>
rake aborted!
Sequel::DatabaseConnectionError: Mysql::Error: Can't connect to MySQL
server on '52.38.29.235' (61)
/Users/barbara/Dev/donorsee-v1/donorsee-api/tasks/db.rake:50:in `block (2
levels) in <top (required)>'
Mysql::Error: Can't connect to MySQL server on '52.38.29.235' (61)
/Users/barbara/Dev/donorsee-v1/donorsee-api/tasks/db.rake:50:in `block (2
levels) in <top (required)>'
```
I have confirmed that my local host is exchanging relevant packets with the
AWS EC2 instance (so it's not a firewall issue). The error message leads me
to believe that the MySQL server has not been configured to accept
connections from outside hosts. However, I've read conflicting
recommendations about how to resolve this issue and the options used to
start the MySQL server have thwarted my attempts to try out recommendations
that pertain to altering user hosts/permissions. I can alter the MySQL
config and restart the server if necessary. Perhaps I need to alter the
bind-address option?
I have attempted to open an SSH tunnel to the AWS instance using
net-ssh-gateway and, even though I have opened the tunnel, I still can't
connect to the OLD_DB. Same error message.
Has anyone encountered this situation?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.