前提・実現したいこと
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)のエラーを解消したい。
mysqlをuninstallし、再installをすると
mysql -u root の際に上記のエラーが出るようになりました。
brew services restart mysql@5.7で
スタート出来ている事は確認取れてます。
発生している問題・エラーメッセージ
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
sudo chown root/tmp/mysql.sock usage: chown [-fhnv] [-R [-H | -L | -P]] owner[:group] file ... chown [-fhnv] [-R [-H | -L | -P]] :group file ...
cd /usr/local/var/mysql/
ls *.err
MacBook-Air.local.err
tail -f MacBook-Air.local.err
省略 /usr/local/Cellar/mysql@5.7/5.7.32/bin/mysqld: Shutdown complete 2021-01-24T05:30:14.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/nakajimaeikounoMacBook-Air.local.pid ended 2021-01-24T05:39:40.6NZ mysqld_safe Logging to '/usr/local/var/mysql/nakajimaeikounoMacBook-Air.local.err'. 2021-01-24T05:39:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql 2021-01-24T05:39:41.041402Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2021-01-24T05:39:41.043628Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2021-01-24T05:39:41.044164Z 0 [Note] /usr/local/Cellar/mysql@5.7/5.7.32/bin/mysqld (mysqld 5.7.32) starting as process 22068 ... 2021-01-24T05:39:41.052860Z 0 [Warning] Setting lower_case_table_names=2 because file system for 2021-01-24T05:39:41.220105Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2021-01-24T05:39:41.221787Z 0 [Warning] CA certificate ca.pem is self signed. 2021-01-24T05:39:41.228842Z 0 [ERROR] Can't start server : Bind on unix socket: Address already in use 2021-01-24T05:39:41.228858Z 0 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql.sock ? 2021-01-24T05:39:41.229052Z 0 [ERROR] Aborting 省略 2021-01-24T05:39:42.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/nakajimaeikounoMacBook-Air.local.pid ended
試したこと
sudo rm -f /var/run/mysqld/mysqld.sock
sudo rm -f /tmp/mysql.sock
sudo /etc/init.d/mysql start
sudo touch /tmp/mysql.sock
sudo chown root/tmp/mysql.sock
$ rm -rf /usr/local/mysql
$ rm -rf /Library/StartupItems/MYSQL
$ rm -rf /Library/PreferencePanes/MySQL.prefPane
$ rm -rf /Library/Receipts/mysql-.pkg
$ rm -rf /usr/local/Cellar/mysql*
$ rm -rf /usr/local/bin/mysql*
$ rm -rf /usr/local/var/mysql*
$ rm -rf /usr/local/etc/my.cnf
$ rm -rf /usr/local/share/mysql*
$ rm -rf /usr/local/opt/mysql
参考サイト
https://blog.katsubemakito.net/macos/install-mysql-on-homebrew
https://qiita.com/masa_stone22/items/38a286a89c309de7d44e
https://qiita.com/gaogaomango/items/933a1f55004920a4323d
補足情報(FW/ツールのバージョンなど)
OS Catalina
バージョン10.15.7
mysql5.7
mysql_secure_installation
を入力してenterを押しても
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
このエラーになります。
宜しくお願い致します。
回答1件
あなたの回答
tips
プレビュー