前提・実現したいこと
mysqlが起動できない事態が発生しました。
sudo mysql.server startで起動すると以下のエラーが発生致します。
何か解決策があればお願い致します。
発生している問題・エラーメッセージ
uemuranaoyanoMacBook-Pro:~ kamimuranaoya$ sudo mysql.server start Starting MySQL .. ERROR! The server quit without updating PID file (/var/lib/mysql/uemuranaoyanoMacBook-Pro.local.pid).
試したこと
1.PIDの追加・権限設定
$ ls /var/lib/mysql
binlog.index
//uemuranaoyanoMacBook-Pro.local.pidがなかったので追加して権限も付けてみました。
$ sudo touch /var/lib/mysql/uemuranaoyanoMacBook-Pro.local.pid
$ sudo chown -R _mysql:_mysql /var/lib/mysql
$ sudo mysql.server restart
ERROR! MySQL server PID file could not be found!
Starting MySQL
.. ERROR! The server quit without updating PID file (/var/lib/mysql/uemuranaoyanoMacBook-Pro.local.pid).
//権限付けても /var/lib/mysql/uemuranaoyanoMacBook-Pro.local.pid がすぐに消えてしまいます。
2.MySQL自体を再インストール
$ brew install mysql
Uninstalling /usr/local/Cellar/mysql/8.0.19... (286 files, 289.2MB)
$ brew install mysql
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 4 taps (homebrew/cask-versions, homebrew/core, homebrew/cask and homebrew/services).
==> New Formulae
==> Installing mysql ==> Pouring mysql-8.0.19_1.catalina.bottle.tar.gz
==> mysql
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
//再インストール
$ mysql.server start
Starting MySQL
.. ERROR! The server quit without updating PID file (/var/lib/mysql/uemuranaoyanoMacBook-Pro.local.pid).
//やっぱりダメでした