【问题标题】:Unable to setup mysql in google cloud shell无法在谷歌云 shell 中设置 mysql
【发布时间】:2019-06-15 16:31:25
【问题描述】:

我正在尝试通过 cloud shell 在云引擎中安装 mysql

我安装了它:

sudo apt-get -y install mysql-server

并设置密码:

sudo mysql_secure_installation

当我输入密码时,我收到这个错误:

Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

我该如何解决这个问题?

【问题讨论】:

  • 您是否意识到只有安装在您的主目录中的软件才会持久存在? Cloud Shell 是一个容器。当容器重新启动时,您的 MySQL 实例将消失。我没有答案,因为 Cloud 不支持您尝试做的事情。

标签: mysql google-compute-engine google-cloud-shell


【解决方案1】:

正如 John 所说,Cloud shell 是一个容器。

你应该使用 cloud shell 来登录你的虚拟机

例如,你的虚拟机名称是 mysql-server

gcloud compute ssh username@mysql-server

然后按照您的安装设置进行操作。

或者

gcloud compute ssh username@mysql-server --command 'sudo apt-get -y install mysql-server'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-20
    • 2015-05-09
    • 1970-01-01
    • 2016-08-21
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    相关资源
    最近更新 更多