I’m getting the below error randomly in my Ruby On Rails application whenever the number of requests increases to the server.
Mysql2::Error::ConnectionError (Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)):
I’m not sure whether it is because of my server memory or is it something to do with mysql2 gem. Any help would be really appreciated, thanks in advance.
Ruby '2.5.0'
Rails '5.2.0
Mysql2 0.5.2
Phusion Passenger 5.3.4
Server version: Apache/2.4.6 (CentOS)
RAM SIZE: 1.5GB
MySQL Community Server (GPL): 5.6.41
From there I access the mysql command line shell, set myself as root, run $flush privileges, exit mysql command line, run the login command, and error goes away