LoginSignup
1
0

More than 3 years have passed since last update.

ターミナルでMySQLをすぐ開くメモ(MAMP)

Last updated at Posted at 2019-09-14

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文を打つことができる。

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