Conecte o cliente MySQL remoto ao servidor MySQL

Conecte o cliente MySQL remoto ao servidor MySQL

Posso me conectar localmente, mas não remotamente.

No meu cliente eu tenho:

mysql  Ver 8.0.35-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

No meu servidor eu tenho:

mysql  Ver 8.2.0 for Linux on x86_64 (MySQL Community Server - GPL)

Eu tento me conectar como:

mysql -h 10.0.1.242 -P 33060 -u bob -p

Eu recebo (a tela trava por algum tempo depois que eu digito a senha):

ubuntu@ubuntu-webserver-instance:~$ mysql -h 10.0.1.242 -P 33060 -u bob -p

Enter password: 

ERROR 2003 (HY000): Can't connect to MySQL server on '10.0.1.242:33060' (110)

Meu usuário tem:

CREATE DATABASE pets;
CREATE USER 'bob'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON pets.* TO 'bob'@'%'; 
FLUSH PRIVILEGES;

Eu editei /etc/mysql/my.cnftentando:

[mysqld]
bind_address            = 0.0.0.0
Jan 17 01:02:20 ubuntu-database-instance mysqld[4672]: 2024-01-17T01:02:20.265066Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/>
[mysqld]
bind_address            = 0.0.0.0
mysqlx_bind_address = 0.0.0.0
Jan 17 01:16:37 ubuntu-database-instance mysqld[4783]: 2024-01-17T01:16:37.880551Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '0.0.0.0' port: 33060, socket: /var/run/my>

Estou meio perplexo.

Responder1

entendi!

iptables -I INPUT 6 -m state --state NEW -p tcp --dport 3306 -j ACCEPT

Responder2

Tente conectar-se localmente: No mesmo MySQL SQL Server, use: mysql -h localhost -P 33060 -u bob -p

Se você conseguir se conectar, verifique o firewall em ambos os lados: Servidor e cliente

informação relacionada