No Sssweat
No Sssweat

Reputation: 418

EHost 'ip' is not allowed to connect to this MySQL serverConnection

I have two Instances: A and B

I am trying to connect Instance A to Instance B's mysql db.

On both instances I have added 3600 to the security group

enter image description here

I have edited Instance B's /etc/mysql/my.cnf and added 0.0.0.0 as the bind-address and restarted mysql

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# 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
bind-address           = 0.0.0.0 
#
# * Fine Tuning
#
key_buffer      = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8

But when I'm on Instance A terminal and try telnet [Instance B public ip] 3306 I get

EHost '[Instance A public ip]' is not allowed to connect to this MySQL serverConnection closed by foreign host.

Did I miss a step or did something wrong or something?

Upvotes: 1

Views: 15950

Answers (2)

Nick
Nick

Reputation: 31

You are supposed to grant the permission to IP to avoid seeing this error

mysql -u root -p
Enter password
: <enter password>

>GRANT ALL ON *.* to root@'xx.xx.xx.xx' IDENTIFIED BY 'root';

>FLUSH PRIVILEGES;

Upvotes: 3

Alexey Smirnov
Alexey Smirnov

Reputation: 2613

Do you have a user on Instance B Mysql with all the priveleges? This is a normal behavior when you try to use telnet to connect to mysql. Try something like this from Instance A

mysql -h [Instance B IP] -u [user_name] -p

Upvotes: 3

Related Questions