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

MAMP ver 5.2環境下で、ターミナルからMySQLにログインする

Last updated at Posted at 2018-12-21

MAMPとは:Macintosh環境下で、Apache, MySQL, PHPを用いて開発するための開発環境のこと.
2018年11月現在、MAMPのバージョンはver 5.2となっている.
以下の手順は、MAMP ver 5.2をインストール済みであることを想定しており、
MAMPインストール後にターミナルからmysqlを実行する際のメモ書きである.

アプリケーションのMAMPフォルダを確認する

まずはFinderを開き、アプリケーションフォルダ中のMAMPフォルダを確認してみる.
スクリーンショット 2018-12-21 12.22.59.png
パスは以下になる.
User/Applications/MAMP/Library/bin/mysql

MAMPを起動し、SQLサーバーを立ち上げる

mysqlにログインする前に、MAMP上でサーバーを立ち上げておく.
サーバーの立ち上げに成功すると、MySQL Serverの文字の横にある点が緑色になる.
スクリーンショット 2018-12-21 12.34.57.png
SQLサーバーが立ち上がったら、ログインの準備ok.

ターミナルからmysqlを実行する

ターミナル起動後、mysqlの保存先ディレクトリまで移動する.

# mysqlファイルの保存先であるbinに移動
$ cd Applications/MAMP/Library/bin
# mysqlを実行する
$ ./mysql -u root -p
# passwordを聞かれるので、変更していないのであればデフォルト値であるrootを入力
Enter password: root
# MySQLのプロンプトが表示されれば成功
mysql>

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?