Conecte el cliente MySQL remoto al servidor MySQL

Conecte el cliente MySQL remoto al servidor MySQL

Puedo conectarme localmente pero no de forma remota.

En mi cliente tengo:

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

En mi servidor tengo:

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

Intento conectarme como:

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

Recibo (la pantalla se cuelga durante bastante tiempo después de ingresar la contraseña):

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)

Mi usuario tiene:

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

He editado /etc/mysql/my.cnfintentando:

[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>

Estoy un poco perplejo.

Respuesta1

¡entiendo!

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

Respuesta2

Intente conectarse localmente: en el mismo servidor Mysql SQL, use: mysql -h localhost -P 33060 -u bob -p

Si puede conectarse, verifique el firewall en ambos lados: servidor y cliente

información relacionada