2
3

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.

macOS Catalinaにhomebrew経由でMSQLをいれる

Last updated at Posted at 2020-02-01

状況

新しいmacbook pro(macOS Catalina)を購入したので、homebrewを使ってmysqlを入れようとしたら、エラーがでたので、メモ
Catalinaでのmysqlのエラーは相当でているよう、

mysqlのインストール&動くようにする

1) mysqlのインストール

ターミナルでbrewからインストール

brew install mysql

2) 起動したらエラーがでた

mysql -uroot

でログインしようとしたら、、、

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

3) 動くようにする

ググると結構でてくるエラー。みなさん出ているようです。まずはmysql.sockとやらを作ります。

sudo touch /tmp/mysql.sock

実はこれだけだとダメなので、

sudo chown ユーザー名 /tmp/mysql.sock

で権限を書き換えます。
あと、これをしないと、macを再起動した時に毎回エラーが出る

brew services start mysql

mysqlでテーブルを作るまで

rootで入る

mysql -uroot;

データベースを作成

create database mydb;

作ったmydbに入る

use mydb;

あとはcreate tableで自分で作りたい構造のテーブルを作る

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?