0

I'm trying to install mysql in a cloud engine through the cloud shell

I installed it with:

sudo apt-get -y install mysql-server

And set password with:

sudo mysql_secure_installation

when I input the password, I receive this error:

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")

How can I fix this?

Filipe Ferminiano
  • 8,373
  • 25
  • 104
  • 174
  • 1
    Do you realize that only software that you install in your home directory will persist? Cloud Shell is a container. When the container is restarted your MySQL instance will disappear. I don't have an answer as Cloud does not support what you are trying to do. – John Hanley Jun 15 '19 at 22:58

1 Answers1

2

As John say, Cloud shell is a container.

You should use cloud shell to login to your vm

For example, your VM name is mysql-server

gcloud compute ssh username@mysql-server

Then follow with your install setup.

Or

gcloud compute ssh username@mysql-server --command 'sudo apt-get -y install mysql-server'
howie
  • 2,587
  • 3
  • 27
  • 43