์ค์นํ MySQL์ ์ค์ต
1) MySQL์ ์ ์
Enter password: ********** (์ค์นํ ๋ ์ธํ ํ๋ ๋น๋ฐ๋ฒํธ ์ ๋ ฅ)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.21 MySQL Community Server - GPL
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.
2) DB ๊ฒ์
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
3) DB ์์ฑ
mysql> create database db_study character set utf8 collate utf8_general_ci;
Query OK, 1 row affected, 2 warnings (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| db_study |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.01 sec)
4) DB์ ํ
mysql> use db_study;
Database changed
5) TABLE ์์ฑ
mysql> create table `table_study` (
-> `id` int(20) not null auto_increment,
-> `description` text not null,
-> `created` datetime not null,
-> primary key(id)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected, 2 warnings (0.08 sec)
6) TABLE ์์ฑ ํ์ธ
mysql> show tables;
+--------------------+
| Tables_in_db_study |
+--------------------+
| table_study |
+--------------------+
1 row in set (0.00 sec)
7) TABLE ๋ด์ฉ ํ์ธ
mysql> select * from table_study;
Empty set (0.01 sec)
8) TABLE ๋ด์ฉ ์ฑ์ฐ๊ธฐ
mysql> insert into table_study (description, created) values('test', '2020-09-16 17:19:30');
Query OK, 1 row affected (0.01 sec)
mysql> select * from table_study;
+----+-------------+---------------------+
| id | description | created |
+----+-------------+---------------------+
| 1 | test | 2020-09-16 17:19:30 |
+----+-------------+---------------------+
1 row in set (0.01 sec)
mysql> ๋