I can't seem to get remote access to Mysql running on a Google Cloud/Compute instance. I'm trying to do a plain vanilla install.

  1. I created the instance, using Debian, the default.

  2. I did the apt-get install for mysql, and bizarrely, it installed MariaDB instead. Fine.

  3. I ran sudo mysql mysql_secure_installation and followed the prompts. Bizarrely, it left the mysql.users row for "root" with a plugin column value of "unix_socket", which allows only local access using sudo. Fine. I'll add a new user.

  4. I logged in locally and ran:

    create user 'myname'@'%' identified by 'mypass';

    grant all privileges on * . * to 'mypass'@'%';

    flush privileges;

I can connect using 'myname' from localhost.

  1. I opened up a hole in the Google Cloud firewall for port 3306 on I know I did it correctly, because I created an identical rule for port 8088, and I can communicate remotely to that port just fine.

  2. When I try to connect to mysql from a remote box, I get "Unable to connect to remote host: Connection refused."

This could be a networking problem or a mysql problem, and I can't figure out which. Any ideas?

1 Answer 1


Figured it out. Buried deep in the configuration files, at /etc/mysql/maria.conf.d/50-server.cnf, are these incredible lines:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address        =

Comment out the bind-address and it works.

This is the consequence of the exceptionally poor decision for Debian to install MariaDB when you ask for MySql. There are series of convoluted configuration files, alternately named mysql* and mariadb*, and none do what they purport to do.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.