1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacのMySQLでECONNREFUSED

Posted at

なかなかOKが出なかった

image.png

環境

macOS Catalina(10.15)
MySQL 8.0.17(Homebrew)

経緯

Qiitaの記事を読んで、Node-REDをやってみようとして、MacのローカルにMySQLを導入したものの、どうしても「ECONNREFUSED」(接続拒否)が出て繋がらず。

mysql.user テーブルには 'root'@'localhost' があるものの、どうやら 127.0.0.1 からのアクセスとして認識されている模様。
/etc/hosts127.0.0.1 localhost があるんだから、良いじゃないか……と思っても、繋がらないものは繋がらない。

じゃあ別に追加しないといけないのか……ということでユーザを追加しようとしたら、MySQL8は構文が違うということでエラーになりました。

[参考]のところを参考にさせていただいて、ようやく解決。

mysql> create user 'user'@'127.0.0.1' identified by 'password';
mysql> grant all privileges on {DATABASE_NAME}.* to 'user'@'127.0.0.1';

参考

Mysqlのgrant文でユーザ作成&権限付与しようとしてエラーが出たのでメモ

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?