Home > front end >  MySQL on VM is not responding to external clients
MySQL on VM is not responding to external clients

Time:12-09

I've installed MySQL server on brand new VM with Ubuntu 20.04.5 LTS.

Seems MySQL is not visible. From VM I could access successfully via standard mysql command with the same user and password I have tried remotely, but remotely it does not work.

Added port 3306 as enabled to ufw firewall, also added rule for 3306 TCP to iptables. Checked against local address binding in MySQL config, but there was no such entry. I can access machine via SSH, but not MySQL through same IP address. The user is added for % addresses with standard authentication with password. All privileges also granted.

Tried with jdbc provider from JetBrains Rider IDE - Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Tried with MySql Shell - ArgumentError: X protocol error: MySQL server has gone away Classic protocol error: MySQL Error 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Any suggestions what's wrong?

Thanks.

CodePudding user response:

Probably your MySQL is only listening on localhost

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

search for the bind-address parameter, change 127.0.0.1 to 0.0.0.0 and restart the mysql deamon

sudo systemctl restart mysql

CodePudding user response:

Aww, I missed this file, checked different one configs in the same location. Yes, you're right. There was bind address for local.

Thank you! :)

  • Related