0

I am trying to connect remotely to a MySQL server on webmin (VPS) and I cannot connect to host unless I am connecting using localhost. It is not possible with remote hosts.

The MySQL server is on webmin version 1.994 and virtualmin 7.1-1(Ubuntu Linux 20.04.4 is the operating system).

Port 3306 (TCP) is opened on the firewall. When I try connecting using MySQL workbench I get the error Your connection attempt failed for user 'user' to the MySQL server at xxxxxxxx:3306 unable to connect to localhost.

It happens also when I connect as the root user. I can connect without any problem using phpMyadmin.

I have tried browsing for solutions but I am not able to get a solution. Any help or direction would be greatly appreciated.

Tovs
  • 157
  • 2
  • 13

1 Answers1

0

Hope that this will help:

UPDATE mysql.user SET host='12.34.56.78' WHERE user='root';
Telinov Dmitri
  • 411
  • 4
  • 12
  • Telinov Dmtri your suggestion helped to set the host correctly. However, I am still not able to connect to the server at the set host. When I connect using MySQL workbench I get this message. Your connection attempt failed for user xxxxxxxx to the MySQL server at xx.xx.xx.xx:3306 unable to connect to localhost. I am wondering why it says localhost while I am trying to connect to a different host. – Tovs Jul 23 '22 at 15:44
  • You are trying to connect to localhostL "unable to connect to localhost", try ```mysql -u root -p -h 12.34.56.78``` – Telinov Dmitri Jul 24 '22 at 15:29
  • When try mysql -u root -p -h 12.34.56.78 I get Error 1045 (28000) Access denied for user 'root'@xxxxxxxxx (using password: YES). I have changed the host for the user root and also assigned the same host to the database. Thanks – Tovs Jul 25 '22 at 12:48
  • Aha! It turned out out that I had opened port 3306 on the webmin but the firewall in the server's OS was blocking access. once this was opened, everything worked well. Thanks for your help. – Tovs Jul 25 '22 at 23:54