MySQL is not running stably ... Rails app is not running.

Occurrence background </ font>

MySQL service is in error again. If it happens many times, you will be scared of wasting time. The error content is as follows.

Can't connect to local MySQL server through socket '/tmp/mysql.sock' 

environment </ font>

item Contents
OS.Catalina v10.15.4
Ruby v2.5.1
Ruby On Rails v5.2.4.3
MySQL v5.6

Correspondence procedure </ font>

[Survey 1] Is MySQL running? I'm using "Sequel Pro", so I'll try connecting. → Connection error

Check the operating status of the process


CMD>ps -ef | grep mysql
  501  1287     1   0 11:45AM ??         0:00.06 /bin/sh /usr/local/opt/[email protected]/bin/mysqld_safe --datadir=/usr/local/var/mysql
  501  6400  1287   0 11:55AM ??         0:00.51 /usr/local/opt/[email protected]/bin/mysqld --basedir=/usr/local/opt/[email protected] --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/[email protected]/lib/plugin --log-error=ichikawadaisukenoMacBook-Air.local.err --pid-file=ichikawadaisukenoMacBook-Air.local.pid
  501  6402   804   0 11:55AM ttys000    0:00.01 grep mysql

!! ?? Looks like it's working! ??

[Survey 2] First of all, from the error content. It is said that there is no socket file, so I tried using the following command.

Try creating a socket file.


CMD>cd application folder
CMD>touch /tmp/mysql.sock

→ As a result, no improvement.

[Survey 3] Check the log.

Check the MySQL log


CMD>more /usr/local/var/mysql/ichikawadaisukenoMacBook-Air.local.err
(Partially omitted)
mysqld_safe A mysqld process already exists
  • Rebooting after this did not improve.

Correspondence

It looks like the process is running multiple times. Stop an existing running process.

Process stop


CMD>kill -9 Target service process

This time it just improved. However, the following error message is still output.

200616 16:04:42 mysqld_safe A mysqld process already exists

I will deal with it at a later date.

Recommended Posts