環境 MacOS Catalina 10.15.7
mysql@5.6
ある日ローカルのmySQLが動かなくなりました。原因はしっかり理解できてませんが、おそらくHomebrewなどのupdateが絡んでいるのかと考えています
多くの記事を見て権限の付与やpidファイルの作成などしましたが、結局うまくいかず
mySQLの再インストールをすることにしました
参考にした記事はHomebrewで入れたMySQLが起動できないのでアンインストール&再インストールした話
行ったことは以下の内容で
#mysqlのアンインストール % brew uninstall mysql@5.6
#残るファイルの削除 % sudo rm -rf /usr/local/Cellar/mysql* % sudo rm -rf /usr/local/bin/mysql* % sudo rm -rf /usr/local/var/mysql* % sudo rm -rf /usr/local/share/mysql* % sudo rm -rf /usr/local/opt/mysql* % sudo rm -rf /usr/local/etc/my.cnf % sudo rm -rf /etc/mysql/my.cnf % sudo rm -rf /etc/my.cnf % sudo rm -rf ~/.my.cnf
を行ったのち
#以下を確認 % brew doctor Your system is ready to brew. #mysqlのインストール % brew install mysql@5.6 % echo 'export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"' >> ~/.zshrc % source ~/.zshrc
を行い以下も確認しました
% which mysql /usr/local/opt/mysql@5.6/bin/mysql
ここで以下に進むと
% mysql.server start Starting MySQL ./usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld_safe: line 616: /usr/local/var/mysql/usernoMacBook-Pro.local.err: No such file or directory Logging to '/usr/local/var/mysql/usernoMacBook-Pro.local.err'. /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld_safe: line 138: /usr/local/var/mysql/usernoMacBook-Pro.local.err: No such file or directory /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld_safe: line 183: /usr/local/var/mysql/usernoMacBook-Pro.local.err: No such file or directory /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld_safe: line 865: /usr/local/var/mysql/usernoMacBook-Pro.local.err: No such file or directory /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld_safe: line 138: /usr/local/var/mysql/usernoMacBook-Pro.local.err: No such file or directory ERROR! The server quit without updating PID file (/usr/local/var/mysql/usernoMacBook-Pro.local.pid).
となり何回かやりましたが /usr/local/varの中にmysqlというディレクトリーが作成されないためこの様なエラーが出てしまいます
そこで/usr/local/var/mysqlのディレクトリーを % mkdir /usr/local/var/mysql したのち
もう一度 mysql.server startすると
% mysql.server start Starting MySQL .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/usernoMacBook-Pro.local.pid).
となってしまい、ここから抜け出すことができません
pidファイルを置くことを考えて
% cd /usr/local/var/mysql #pidファイルを置く % sudo touch usernoMacBook-Pro.local.pid #mysql起動 % sudo mysql.server restart ERROR! MySQL server PID file could not be found! Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/var/mysql/usernoMacBook-Pro.local.pid).
となりエラーから抜け出せません
#mySQLのエラーファイルの中身をみる 201106 21:20:12 mysqld_safe Logging to '/usr/local/var/mysql/usernoMacBook-Pro.local.err'. 201106 21:20:12 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql 2020-11-06 21:20:12 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-11-06 21:20:12 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2020-11-06 21:20:12 0 [Note] /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld (mysqld 5.6.50) starting as process 12854 ... 2020-11-06 21:20:12 12854 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive 2020-11-06 21:20:12 12854 [Note] Plugin 'FEDERATED' is disabled. /usr/local/Cellar/mysql@5.6/5.6.50/bin/mysqld: Table 'mysql.plugin' doesn't exist 2020-11-06 21:20:12 12854 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2020-11-06 21:20:12 12854 [Note] InnoDB: Using atomics to ref count buffer pool pages 2020-11-06 21:20:12 12854 [Note] InnoDB: The InnoDB memory heap is disabled 2020-11-06 21:20:12 12854 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-11-06 21:20:12 12854 [Note] InnoDB: Memory barrier is not used 2020-11-06 21:20:12 12854 [Note] InnoDB: Compressed tables use zlib 1.2.11 2020-11-06 21:20:12 12854 [Note] InnoDB: Using CPU crc32 instructions 2020-11-06 21:20:12 12854 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2020-11-06 21:20:12 12854 [Note] InnoDB: Completed initialization of buffer pool 2020-11-06 21:20:12 12854 [Note] InnoDB: Highest supported file format is Barracuda. 2020-11-06 21:20:12 12854 [Note] InnoDB: 128 rollback segment(s) are active. 2020-11-06 21:20:12 12854 [Note] InnoDB: Waiting for purge to start 2020-11-06 21:20:12 12854 [Note] InnoDB: 5.6.50 started; log sequence number 1600627 2020-11-06 21:20:12 12854 [Note] RSA private key file not found: /usr/local/var/mysql//private_key.pem. Some authentication plugins will not work. 2020-11-06 21:20:12 12854 [Note] RSA public key file not found: /usr/local/var/mysql//public_key.pem. Some authentication plugins will not work. 2020-11-06 21:20:12 12854 [Note] Server hostname (bind-address): '*'; port: 3306 2020-11-06 21:20:12 12854 [Note] IPv6 is available. 2020-11-06 21:20:12 12854 [Note] - '::' resolves to '::'; 2020-11-06 21:20:12 12854 [Note] Server socket created on IP: '::'. 2020-11-06 21:20:12 12854 [ERROR] Can't start server : Bind on unix socket: Permission denied 2020-11-06 21:20:12 12854 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ? 2020-11-06 21:20:12 12854 [ERROR] Aborting <略> 201106 21:20:13 mysqld_safe mysqld from pid file /usr/local/var/mysql/usernoMacBook-Pro.local.pid ended
上記エラーログの[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.が気になったのですが
% mysql_upgrade -u root -p Enter password: Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck Error: Failed while fetching Server version! Could be due to unauthorized access. FATAL ERROR: Upgrade failed
となってしまい変化がありません
他に気になるところはmySQLインストール時のwarnigが気になり指示通り
brew postinstall mysql@5.6 を試すのですが
% brew install mysql@5.6 Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles/mysql%405.6-5.6.50.catalina.bottle.tar.gz Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/5280efc3ef372fc8e28675bff6c83a2f6cdd31d25babd1fa95011bbd7c421df5--mysql@5.6-5.6.50.catalina.bottle.tar.gz ==> Pouring mysql@5.6-5.6.50.catalina.bottle.tar.gz Warning: The post-install step did not complete successfully You can try again using `brew postinstall mysql@5.6` ==> Caveats A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. MySQL is configured to only allow connections from localhost by default To connect: mysql -uroot mysql@5.6 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have mysql@5.6 first in your PATH run: echo 'export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"' >> ~/.zshrc For compilers to find mysql@5.6 you may need to set: export LDFLAGS="-L/usr/local/opt/mysql@5.6/lib" export CPPFLAGS="-I/usr/local/opt/mysql@5.6/include" To start mysql@5.6: brew services start mysql@5.6 Or, if you don't want/need a background service you can just run: /usr/local/opt/mysql@5.6/bin/mysql.server start ==> Summary ???? /usr/local/Cellar/mysql@5.6/5.6.50: 343 files, 156.2MB user@usernoMacBook-Pro car-kobo % brew postinstall mysql@5.6 ==> Postinstalling mysql@5.6 Warning: The post-install step did not complete successfully You can try again using `brew postinstall mysql@5.6`
#warningの対応 % brew postinstall mysql@5.6 ==> Postinstalling mysql@5.6 Warning: The post-install step did not complete successfully You can try again using `brew postinstall mysql@5.6` #失敗
の状態になってしまい全く解決方法がわからない状態です
もし良い方法などご存知の方がいらっしゃいましたらご教示いただけないでしょうか
よろしくお願いします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/11/07 05:41