MAMPを起動しておく。
まず下記コマンドでディレクトリを移動
~$
$ cd /Applications/MAMP/Library/bin/
そのあと、SQLにログイン
~$
$ ./mysql -u root -p
パスワード入力が求められるので、自分のパソコンのパスワードを打ち込む
Enter password: 〇〇(パスワード)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 〇〇〇
Server version: 5.〇.〇 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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>
となり、
ここでいきなりSQL文を書くと
ERROR 1046 (3D000): No database selected
使用テーブルを指定していないのでエラーが出る。
そこで、
mysql> USE 〇〇(テーブル名);
と打つ。すると、
Database changed
となり、
好きなSQL文を打つことができる。