LoginSignup
1
0

More than 3 years have passed since last update.

MySQLでデータベースを削除する

Posted at

自分の忘備録としてMySQLで使わなくなったデータベースの削除方法を残します

消去の流れ

1.MySQLにログイン

MySQLを使用するには、ターミナルからログインします。
ホームディレクトリから接続します。

『-u root』はオプションで、「ユーザーは『ルート』でログインする」という意味です。

ここでいうルートとは、MySQLであらかじめ用意されているユーザーのことです。


% cd

# MySQLに接続
% mysql -u root

MySQLに接続すると以下のような表示になリます。


% mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 428
Server version: 5.6.47 Homebrew

Copyright (c) 2000, 2020, 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はmysql>の続きから入力して実行ができます。

2.SHOW文で消したいデータベースを確認


mysql> SHOW DATABASES ;

3.DROP文でデータベースを削除


mysql> DROP DATABASE 《データベース名》;
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