Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Mysql broken after free trial end

My problem is simple: I have a website hosted on a GC compute engine VM. For the 3 months of trial, the website functioned normally, using a mysql database from within the VM. However, after 7 days after my billing account being upgraded to a billed, paid account, mysql is no more available. The error I'm getting is the following: ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (111).

Do you have any idea why this happened? Do you know how to solve it. The file /run/mysqld/mysqld.sock exists when ls command is run, but trying to view its contents with cat does not work.

Thank you in advance!

Solved Solved
1 5 368
1 ACCEPTED SOLUTION

Okay, did you've checked the logs? Typically  /var/log/mysql/error.log or /var/log/mysqld.log

Also, check the socket file existence. If doesn't exists,
simply perform following commands:

sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld

 and restart service. 

Additionally you could check whether SQL is listening on 3306

sudo lsof -i -P -n | grep 3306

As a last step reinstall DB.

sudo apt-get remove --purge mysql-server mysql-client mysql-common

or

sudo yum remove mysql-server
sudo yum install mysql-server

--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost

View solution in original post