230525_SQL4

김지태·2023년 5월 26일
0
post-thumbnail

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ mysql -u root -pz1234
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.33 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| sys |
| testdb |
| world |
| zerobase |
+--------------------+
8 rows in set (0.05 sec)

mysql> use zerobase
Database changed
mysql> show tables;
+--------------------+
| Tables_in_zerobase |
+--------------------+
| celeb |
| refueling |
| snl_show |
| test1 |
| test2 |
+--------------------+
5 rows in set (0.01 sec)

mysql> show ^C
mysql> exit
Bye

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ -u root -p zerobase
bash: -u: command not found

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ mysql -u root -p zerobase
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.33 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> show tables;
+--------------------+
| Tables_in_zerobase |
+--------------------+
| celeb |
| refueling |
| snl_show |
| test1 |
| test2 |
+--------------------+
5 rows in set (0.00 sec)

mysql> source test01.sql
Query OK, 0 rows affected (0.07 sec)

mysql> show tables;
+--------------------+
| Tables_in_zerobase |
+--------------------+
| celeb |
| police_station |
| refueling |
| snl_show |
| test1 |
| test2 |
+--------------------+
6 rows in set (0.00 sec)

mysql> desc police_station;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| name | varchar(16) | YES | | NULL | |
| address | varchar(128) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> exit
Bye

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ mysql -u root -p zerobase < test02.sql
Enter password: ****

SAMSUNG@DESKTOP-U4636R1 MINGW64 ~/Documents/sql_ws
$ mysql -u root -p zerobase
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.33 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> use zerobase
Database changed
mysql> desc crime_status
-> ;
+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| year | year | YES | | NULL | |
| police_station | varchar(8) | YES | | NULL | |
| crime_type | varchar(16) | YES | | NULL | |
| status_type | char(2) | YES | | NULL | |
| case_number | int | YES | | NULL | |
+----------------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

profile
데이터 분석가

0개의 댓글