Solved

How do I connect local MySQL Developer Workbench to remote AWS hosted MySQL database?

Posted on 2014-01-14
11
1,877 Views
Last Modified: 2014-11-12
Hi:

I'm trying to connect my local (windows based) desktop copy of MySQL Developer workbench to a MySQL DB hosted on AWS (EC2 instance).

AWS/MySQL is set up such that I can connect to the database via phpMyAdmin.
So, I'm assuming that the AWS version of MySQL is set up for remote access.
I'm not fond of using phpMyAdmin's web-based interface.

What are the steps I need to do connect to the AWS MySQL DB through my desktop version of Developer Workbench. I know that I've been able to get this working in the past.

Thanks in advance for your time.

JohnB
0
Comment
Question by:jxbma
  • 6
  • 4
11 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39780871
See if phpMyAdmin shows you an IP address for the MySQL server.  Try using that along with your username and password.  Note that if your only login is for 'localhost', you will not be able to make a remote connection.
0
 
LVL 1

Author Comment

by:jxbma
ID: 39781009
This is how I access the AWS based MySQL DB through phpmyadmin:

https://generatedname.mx1.ch/phpmyadmin/

I don't explicitly see any reference to an IP address.

On a previous project, I believe I was able to copy/paste the URL into the Hostname field of the Manage Server Connections dialog.

I looked at the MySQl--> my.cnf file on the server.
It doesn't look like it's got external access turned off.
The port number is the same.

How do I proceed?

Thanks,
JohnB

JB
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39781098
On the main page in phpMyAdmin, there is a line showing the 'server' and another showing the 'user'.  MySQL users are defined by username, password, and access method.  Many places only allow 'localhost' access as a means of preventing unwanted external access.

In the link below, 'monty'@'localhost' and 'monty'@'%' are two different users although we often set them up with the same password.  'monty'@'%' is allowed to connect from anywhere but 'localhost'.  And 'monty'@'localhost' is Only allowed to connect from 'localhost' and Not remotely.  'monty'@'%' can also be 'monty'@'12.34.56.78' which is some specific IP address.

http://dev.mysql.com/doc/refman/5.6/en/adding-users.html
0
 
LVL 1

Author Comment

by:jxbma
ID: 39781388
OK. So I added a new user called root to the MySQL DB through phpmyadmin:

I used the following commands:

CREATE USER 'root'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Open in new window


I still get the following error message:
"Failed to Connect to MySQL at https://generatedname.mx1.ch:3306 with user root"
Unknown MySQL server host 'https://generatedname.mx1.ch' 

Open in new window


If I look at the user table the privilege columns look pretty much the same as what I see for  "user@localhost".

I think the my.cnf file looks OK.
I've attached a copy of it to this comment.

Since I have admin privileges on the VM and in MySQL, I should be able to set this up correctly?

OK, so within the my.cnf file, I see the following line:
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

Open in new window


Uhg.
What am I doing wrong here?
I'm assuming I somehow need to change/disable this  to something and restart the MySQL Server?

Thanks,
JohnB
my.cnf.txt
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39781436
Yes, change it to '0.0.0.0' to allow any IP to access the server.  It is Strongly recommended that you do not allow 'root'@'%'.  'root' has all privileges on all setting on all databases on the server and it is considered very insecure to allow remote access for 'root'.

Info on the bind-address here: http://dev.mysql.com/doc/refman/5.6/en/server-options.html
0
Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

 
LVL 1

Author Comment

by:jxbma
ID: 39781453
Hey David:

This is a dev instance, so I'm not quite as worried about security right now.

Questions:
--------------

1) I stopped/started the MySQL service, changed the bind address to 0.0.0.0,
    I still can't connect. It's not recognizing the server host.

2) Should I be creating my MySQL Workbench connection using Standard (TCP/IP) or Standard TCP/IP over SSH? (I do have a ppk key file that I use to connect to basic AWS instance with WinSCP and PUTTY)

3) Regarding the "root" user. Should I create a different user with @'%'?

At this point, I really, really want to get this up and functional for development purposes.

Thanks,
JohnB
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39781479
I would use Standard without SSH.  SSH requires you to set up tunneling and that just complicates things at the moment.  And yes, a different user with @'%'.

While it won't do anything but test the connection, you can try 'telnet' to that server on port 3306 just to see what response you get.  The firewall on the server or network could still be blocking access.
0
 
LVL 1

Author Comment

by:jxbma
ID: 39781508
OK. Cannot connect to that server on port 3306 via telnet.
How do I tell which end is blocking?
I looked @ event logs on windows 7 machine and don't see anything there.

JB
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39781516
It is almost certainly the remote server because (at least for Windows firewall), outgoing connections are almost always permitted.
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39781522
0
 
LVL 32

Expert Comment

by:shalomc
ID: 39782994
You must grant ingress access to your IP address (or to the world) in the EC2 security group associated with your server.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now