๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๊ฐ•ํ™”๋„๋ผ์ดํ”„/๋ธ”๋กœ๊ทธ & ์›น ์‚ฌ์ดํŠธ

์œˆ๋„์šฐ์—์„œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค(MySQL) ์‹ค์Šต1

์„ค์น˜ํ•œ 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> ๋

๋ฐ˜์‘ํ˜•

"์ด ํฌ์ŠคํŒ…์€ ์ฟ ํŒก ํŒŒํŠธ๋„ˆ์Šค ํ™œ๋™์˜ ์ผํ™˜์œผ๋กœ, ์ด์— ๋”ฐ๋ฅธ ์ผ์ •์•ก์˜ ์ˆ˜์ˆ˜๋ฃŒ๋ฅผ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค."