Vijay Ande Vijay Ande - 11 months ago 78
MySQL Question

connect to mysql on Windows 7 from Amazon EC2 Instance

I have installed "Mysql Workbench 6.3 CE" on my windows 7 laptop, I have my Hadoop 3 node cluster setup on Amazon EC2 Instance. Now I want to import data from Mysql which is installed on my windows 7 laptop to my Hadoop Instance on Amazon EC2.

I have gone through this article:
Connect to remote mysql via terminal

the above article says :

Try to comment the bind-address = in your /etc/mysql/my.cnf

since Mysql is installed on windows machine I don't find the file
on my Amazon Instance.

on my windows 7 machine i tried to look at
C:\Program Files\MySQL\MySQL Server 5.7/my.ini
but i dont see any line that says "bind-address"

any help on my above query would be of great help since I was trying this long time by going through different articles of yours and other web sites.

Amazon EC2 Instance
Amazon EC2 Instance connected - Mysql on Windows 7 Machine

Answer Source

So the setup is something like this :

# Local notebook : Mysql server +  Mysql workbench 
# AWS : EC2 Hadoop instance

And you want to EXPORT data from your local notebook to EC2 Hadoop?

I assume you want to do this (replace the indicator name with your own)

# 1. export your database table to a file  
#  execute "mysqldump -u your_db_username -p your_dbname > dbname.sql" 

# 2. copy the file to ec2 hadoop instance 
# ssh copy to remote host "scp dbname.sql  ubuntu@your_hadoop_ip -i your_hapoop_pem_key"

# 3. ssh to your_hadoop_ip and do the import. 

If you intend to connect FROM AWS EC2 to your LOCAL laptop, that is another story.

Short answer : Not your way. If you just want to put data to hadoop, use above export and import step.

Longer answer : you can create a temporary SSH reverse tunnel to allow the cloud EC2 server connect to your local notebook. It is tedious and you need good network knowledge to fix it if it doesn't work.

Here is an example : reverse ssh tunneling. This is not as easy because you need to know i. you notebook public IP address ii. Allow inbound for that inbound port inside VPC security group ,etc.