0
  1. I created an EC2 with a free tier. Inside EC2, I install docker stuff.
  2. I followed, this tutorial, to install mysql/mysql-server:8.0.19-1.1.15.
  3. I created new users, with root and foo, and of course passwords for these users.
  4. I ran the docker image with exposing port 3306 and tried connecting to it from MySQL Workbench.

The information I filled in for the connection

Hostname: #IPv4 Public IP of my EC2

Port: 3306 

Username: foo

But I got the following error

enter image description here

Any ideas for my problem?

Uvuvwevwevwe
  • 971
  • 14
  • 30
  • What exactly did you do to run the image? There are two separate Docker verbs "expose" and "publish", which sound similar, but "expose" does almost nothing. In an EC2 context there are also security groups to worry about. – David Maze Jan 18 '20 at 18:18
  • Thanks for your question, @DavidMaze! I meant **run image** by executing `docker run --name=mysql-testing -d -p 3306:3306 mysql/mysql-server:8.0.19-1.1.15`. Could you please share with me what things regarding security I should take care of? – Uvuvwevwevwe Jan 18 '20 at 18:54

1 Answers1

0

I just figure out the solution. It is probably about the security problem

enter image description here

There are a few points you should take care

  1. Connection Method: Standard TCP/IP over SSH
  2. SSH Hostname is the Public DNS (IPv4) of your EC2 instance
  3. SSH Key File is the thing you downloaded when creating EC2
  4. You might get the error Access Denied for User 'foo'@'bar' (using password: YES) - No Privileges?. To solve this, try this solution
Uvuvwevwevwe
  • 971
  • 14
  • 30