LoginSignup
33
27

More than 5 years have passed since last update.

MAMPのMySQLにターミナルで接続する方法

Last updated at Posted at 2015-02-03

手順

1)MAMPを起動します。

2)ターミナルを起動します。

3)「cdコマンド」で作業ディレクトリを移動します。

4)MySQLをコマンドラインで操作。

5)MAMPのMySQLにあるデータベースを表示。

 
 
参考
http://qiita.com/kitakayu/items/65a130c9fca66712c604

http://webkaru.net/mysql/mamp-command-line/
kobito.1422931049.845553.png
 

1・2)MAMPを起動し、ターミナルを起動してください。

3)「cdコマンド」で作業ディレクトリを移動する。

MAMPのコマンド群は「/Applications/MAMP/Library/bin/」に格納されているので、「cdコマンド」で作業ディレクトリを移動します。

$ cd /Applications/MAMP/Library/bin/

4)MySQLをコマンドラインで操作する。

$ ./mysql -u root -p
Enter password: ←パスワードを入力する。
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 227
Server version: 5.5.38 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

MySQLのプロンプト(mysql>)が表示されれば、MySQLに接続成功です。

5)MAMPのMySQLにあるデータベースを表示。

mysql> SHOW DATABASES;

MAMPのMySQLにあるデータベースが表示されれば、OKです。

33
27
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
33
27