0
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.

MySQL コマンドプロンプトでの基本操作(随時追加)

Last updated at Posted at 2019-08-01

##接続

shell> mysql -u root -p
Enter password:

##切断

mysql> QUIT
Bye

##バージョン番号と現在の日付を照会する単純なコマンド

mysql> SELECT VERSION(), CURRENT_DATE;
+--------------+--------------+
| VERSION()    | CURRENT_DATE |
+--------------+--------------+
| 5.6.1-m4-log | 2010-08-06   |
+--------------+--------------+
1 row in set (0.01 sec)
mysql>

##入力途中のコマンドの実行を取り消す
\c と入力

mysql> SELECT
    -> USER()
    -> \c
mysql>

##新しいデータベースを作成する

mysql> CREATE DATABASE db_name;

確認

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
+--------------------+

##使用するデータベースを指定する

mysql> USE db_name;
0
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
0
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?