🗒️

MySQL で「ERROR! The server quit without updating PID file」エラーが発生する

2024/08/30に公開

はじめに

下記のコマンドでMySQLを開始させた時に「ERROR! The server quit without updating PID file」エラーが発生する際の対処方法です。

コマンド

$ mysql.server start
Starting MySQL
./opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysqld_safe: line 626: /opt/homebrew/var/mysql/PC-1234.err: Permission denied
Logging to '/opt/homebrew/var/mysql/PC-1234.err'.
/opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysqld_safe: line 144: /opt/homebrew/var/mysql/PC-1234.err: Permission denied
/opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysqld_safe: line 198: /opt/homebrew/var/mysql/PC-1234.err: Permission denied
/opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysqld_safe: line 885: /opt/homebrew/var/mysql/PC-1234.err: Permission denied
rm: /opt/homebrew/var/mysql/PC-1234.pid.shutdown: Permission denied
/opt/homebrew/Cellar/mysql@5.7/5.7.44_1/bin/mysqld_safe: line 144: /opt/homebrew/var/mysql/PC-1234.err: Permission denied
 ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/PC-1234.pid).

環境

  • M2 MacBook Pro
  • Homebrew
  • HomebrewでインストールしたMySQL 5.7

解決方法

下記のコマンドを実行します。

$ sudo chown -R $USER /opt/homebrew/var/mysql/
$ mysql.server start
Starting MySQL
 SUCCESS!

Discussion