티스토리 뷰

mariadb 를 설치했는데 샘플 데이터가 없어서, 간단한 crud 하려면 억지로 데이터를 만들어야 하는 불편함이 있다. 그런 경우 샘플데이터를 설치하면 바로바로 테스트 해볼 수 있다. https://github.com/datacharmer/test_db/releases 로 가서 다운받는다.

 

다운 받은 파일을 폴더에 잘 풀어 놓고, 해당 폴더로 접근후에 mysql 를 실행한다. 해당 폴더로 접근하는것은, 다른 폴더에서 절대경로로 해당 파일을 실행하면, 그 스크립트내 상대경로로 실행될 명령어들이 오류를 내기때문이다. 예를 들면 아래와 같은 오류.

 

그래서 mysql 실행할때는 스크립트를 실행할 폴더로 이동을 먼저한다. mysql 쉘내에서 현재경로를 조회도 해서 확인한다.

> cd /data/test_db
> mysql -h127.0.0.1 -P3306 -uroot -proot_pw test

MariaDB [test]> \! echo $PWD
/data/test_db

 

자! employees 샘플 데이터베이스를 설치해보자. 

MariaDB [test]> \. employees.sql
Query OK, 8 rows affected (0.076 sec)

Query OK, 1 row affected (0.014 sec)

Database changed
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
1 row in set (0.000 sec)

Query OK, 0 rows affected, 6 warnings (0.009 sec)

Query OK, 0 rows affected (0.001 sec)

+------------------------+
| INFO                   |
+------------------------+
| storage engine: InnoDB |
+------------------------+
1 row in set (0.001 sec)

Query OK, 0 rows affected (0.025 sec)

Query OK, 0 rows affected (0.022 sec)

Query OK, 0 rows affected (0.034 sec)

Query OK, 0 rows affected (0.016 sec)

Query OK, 0 rows affected (0.021 sec)

Query OK, 0 rows affected (0.017 sec)

Query OK, 0 rows affected (0.013 sec)

Query OK, 0 rows affected (0.013 sec)

Query OK, 0 rows affected (0.000 sec)

+---------------------+
| INFO                |
+---------------------+
| LOADING departments |
+---------------------+
1 row in set (0.000 sec)

Query OK, 9 rows affected (0.016 sec)
Records: 9  Duplicates: 0  Warnings: 0

+-------------------+
| INFO              |
+-------------------+
| LOADING employees |
+-------------------+
1 row in set (0.000 sec)

Query OK, 17944 rows affected (0.257 sec)
Records: 17944  Duplicates: 0  Warnings: 0

...(중략)...

Query OK, 16209 rows affected (0.114 sec)
Records: 16209  Duplicates: 0  Warnings: 0

+------------------+
| INFO             |
+------------------+
| LOADING dept_emp |
+------------------+
1 row in set (0.001 sec)

Query OK, 24940 rows affected (0.392 sec)
Records: 24940  Duplicates: 0  Warnings: 0

...(중략)...

Query OK, 12609 rows affected (0.103 sec)
Records: 12609  Duplicates: 0  Warnings: 0

+----------------------+
| INFO                 |
+----------------------+
| LOADING dept_manager |
+----------------------+
1 row in set (0.001 sec)

Query OK, 24 rows affected (0.003 sec)
Records: 24  Duplicates: 0  Warnings: 0

+----------------+
| INFO           |
+----------------+
| LOADING titles |
+----------------+
1 row in set (0.001 sec)

Query OK, 21707 rows affected (0.293 sec)
Records: 21707  Duplicates: 0  Warnings: 0

...(중략)...

Query OK, 15401 rows affected (0.101 sec)
Records: 15401  Duplicates: 0  Warnings: 0

+------------------+
| INFO             |
+------------------+
| LOADING salaries |
+------------------+
1 row in set (0.001 sec)

Query OK, 25526 rows affected (0.209 sec)
Records: 25526  Duplicates: 0  Warnings: 0

...(중략)...

Query OK, 7671 rows affected (0.286 sec)
Records: 7671  Duplicates: 0  Warnings: 0

+---------------------+
| data_load_time_diff |
+---------------------+
| 00:00:53            |
+---------------------+
1 row in set (0.002 sec)

 

 

설치는 잘된거 같으니, 테이블 목록을 확인한다.

MariaDB [employees]> show databases;
+--------------------+
| Database           |
+--------------------+
| employees          |
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.023 sec)

MariaDB [employees]> show tables;
+----------------------+
| Tables_in_employees  |
+----------------------+
| current_dept_emp     |
| departments          |
| dept_emp             |
| dept_emp_latest_date |
| dept_manager         |
| employees            |
| salaries             |
| titles               |
+----------------------+
8 rows in set (0.003 sec)

 

jupyter notebook 에서 커넥션연결되는거를 확인했다.

 

마지막으로 DBeaver 설치해서 데이터를 확인해본다. 

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함