1
0

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 3 years have passed since last update.

MAMPのMySQLサーバーに接続する方法

Last updated at Posted at 2020-09-05

MAMPの中のMySQLに、ターミナルでどう入るのか躓きましたのでメモしておきます。

下記コマンドで該当ディレクトリに移動します。私は、Applicationsの前に/を付けていなかったために、ホームのApplicationsとコンピュータが認識して、そこにはMAMPはないため「見つからない!」という事態に陥ってまぁまぁ時間をロスしました。/をお忘れなきよう。

$ cd /Applications/MAMP/Library/bin

次にMySQLにログインします。なぜかはよく分からないのですが、./という相対パスを付けないとcommande not foundと言われてしまい、先に進めませんでした。ここが今回の躓きポイントでした。

$ ./mysql -u root -p

これを実行するとPWを聞いてきますが、パスワードはMAMPのトップページに書いてあります。PCのパスワードではないです(←私がやったミス)。また、別途MAMPのパスワードを変更している場合は、そのパスワードを入力するようです。

パスワードが合っていれば下記のような画面になります↓
プロンプトがmysql>に変わると、MySQLサーバーに接続できたことになります。
sl.png

ちなみに、MySQLを抜けたい時は下記コマンドです。

$ exit

以上です。もしなにかご指摘あればよろしくお願い申し上げます。

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?