1

I have an Amazon AWS EC2 instance running Ubuntu 14.04. where I installed MYSQL 5.5.

I am trying to connect to the MYSQL running on this instance from my local Windows10 machine running Navicat.

State of the env:

3306 is listening

netstat -an | grep 3306 -> tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

MYSQL is started

ubuntu@ip-***-**-**-**:/$ sudo service mysql status
mysql start/running, process 28015

select User, Host from mysql.user;

| blog             | %         |
| blog             | localhost |


mysql> show grants for 'blog'@'%';
+--------------------------------------------------+
| Grants for blog@%                                |
+--------------------------------------------------+
| GRANT USAGE ON *.* TO 'blog'@'%'                 |
| GRANT ALL PRIVILEGES ON `blogdb`.* TO 'blog'@'%' |
+--------------------------------------------------+
2 rows in set (0.00 sec)

telnet from my PC to the server does not work -> need to sleep. will come back tomorrow :)

I am connected to the Ubuntu instance via SSH using a private key.

The former problem:

When trying to connect from windows using Navicat to MYSQL running on my AWS instance I get the following error:

Can't connect to Mysql server on '41.42.434.169' (10061 "Unknown error") -> the IP stated here is not mine

The Host name/IP Address I use is the Public IP of my AWS instance.

This was fixed by commenting the # bind-address = 127.0.0.1 in my.cnf

Now telnet from my PC works

EDIT

Now I get the following error:

Access denied for user blog@myIPprovider.com ( using password: YES )

5
  • Welcome to Ask Ubuntu! I am not sure what exactly is your question. Are you getting an error message when trying to connect to the server? Could you elaborate a bit? :) – Andrea Lazzarotto Jun 14 '16 at 21:48
  • Hi, thx. I am sorry, the question got lost in the explanation :) – Igor L. Jun 15 '16 at 5:44
  • Did you open up the port in AWS security profile for the server? – user508889 Jun 15 '16 at 12:06
  • Hi, thank you for commenting. I managed to have a successfull telnet from my PC to the server. Now the problem is in the -- Access denied for user blog@myIPprovider.com ( using password: YES ) -- (I dont know if I should not start a new question - it is getting a bit messy here) – Igor L. Jun 15 '16 at 16:28
  • @bc2946088 btw, yes in the instance I created a group also opening the port for this group for mysql - 3306. I opened also for 443 (https), 80(http), 25 (SMTP) and 22 for SSL – Igor L. Jun 15 '16 at 16:33
3

For remote access:

Check etc\mysql\my.cnf to see that the bind-address is not set to 127.0.0.1. Either set it to 0.0.0.0, or, to be more secure, add your IP address:

bind-address      = 127.0.0.1
bind-address      = your_public_ip

Create a user in the mysql table:

CREATE USER 'non-root-user'@'localhost' IDENTIFIED BY 'any_password_u_like';
CREATE USER 'non-root-user'@'%' IDENTIFIED BY 'any_password_u_like';

GRANT ALL ON *.* TO 'non-root-user'@'localhost';
GRANT ALL ON *.* TO 'non-root-user'@'%';

AWS SPECIFIC

Make sure you have an inbound rule for port 3306

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.