大网数据广告活动
服务器运维问答

How do you install MySQL on a Google Compute Engine server?

· 52CE 我爱测

I've recently been trying to set up a compute engine instance that will host a SQL database for one of my projects. Issue is, every time I set up an instance and get everything installed, the port I open in Google's firewall is s…

问题原文

原帖链接 · Piper McCorkle · CC BY-SA 3.0

I've recently been trying to set up a compute engine instance that will host a SQL database for one of my projects. Issue is, every time I set up an instance and get everything installed, the port I open in Google's firewall is still closed and I cannot connect externally to my SQL server.

So far, I've done the following things and they've resulted in failure:

  1. Use mysql-server instead of mariadb-server
  2. Use Debian 8 instead of Ubuntu 16.04 LTS
  3. Create instance allowing all ingress traffic

All of these result in nmap showing the port as closed (as well as ports 80 and 443, which I allowed at the instance's creation) and a MySQL client on my local computer is unable to connect to the server.

I have disabled ufw each time, so it shouldn't be causing any issues.

已采纳解答

原帖链接 · ztaylor54 · CC BY-SA 3.0

I ended up solving this issue - Zeb and I are working together. It wasn't an issue with GCP at all, it was mysql denying the connection because bind-address was set to 127.0.0.1 by default in the config located at /etc/mysql/mysql.conf.d/mysqld.cnf.

# Instead of skip-networking the default is now to listen only on`
# localhost which is more compatible and is not less secure.
bind-address            = 0.0.0.0 
# 127.0.0.1 previously, changed to allow remote connections

After changing that in the config, mysql was listening on 0.0.0.0:3306 as shown by netstat -plutn.

You then need to add a remote user with access, and this post explains it perfectly.

Took a lot of digging, so hopefully this clears it up for anyone else who runs across this issue.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。