MySQL DB 예제소스파일 불러오기 (feat.cmd)
Real MySQL 8.0 책을 공부하게 된지 1달이 지났는데,
아직까지 예제 데이터베이스 생성을 안 했다 .. 진짜 왜 그랬을까?
불편함을 못 느꼈다는 것은 내가 실습을 그만큼 넘겨버렸나봅니다? ㅎㅎㅎㅎ.....그랬나....
해당 책은 깃허브에서 zip 파일을 다운받은 후 예제 데이터베이스를 생성하라고 안내한다.
employees.zip 파일의 압축을 풀고 난 후, employees.sql 파일이 현재 디렉터리에 있다고 가정하고
예제 데이터베이스를 생성하는 아래의 명령어만 제공해줬다.
예제 데이터베이스 생성
CREATE DATABASE employees
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE employees
SOURCE employees.sql

처음에는 내가 zip 파일에 해당하는 디렉터리 설정을 안 해줬기 때문에
그래서 아 ^^ 네 ^^ 해보겠습니다 ~ 하는 마음으로 cmd에 디렉터리를 넣었는데

네?.. 선생님? 이게 뭐죠 ??
당황했지만 ~ 좀 더 (시각적으로) 예쁘게 보기 위해 노션을 켰다.
역시 예쁜건 최고야
Microsoft Windows [Version 10.0.26100.3775]
(c) Microsoft Corporation. All rights reserved.
C:\Users\user>cd ..
C:\Users>cd ..
C:\>cd "C:\Users\user\Downloads\realmysql80-main\realmysql80-main"
C:\Users\user\Downloads\realmysql80-main\realmysql80-main>SOURCE employees.sql
'SOURCE'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.
C:\Users\user\Downloads\realmysql80-main\realmysql80-main>cd employees.sql
디렉터리 이름이 올바르지 않습니다.
C:\Users\user\Downloads\realmysql80-main\realmysql80-main>cd "employees.sql"
디렉터리 이름이 올바르지 않습니다.
구글링으로 나와 똑같은 에러를 낸 사람을 찾았습니다.
진짜 감사합니다. 복 받으세요
MySQL 실행
C:\Users\user\Downloads\realmysql80-main\realmysql80-main>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)
employees.sql까지 디렉토리로 넣어줘야 할 줄 알았지만, 그런게 아니었다.
바로 MySQL을 실행시키길래 넵 ^^ 하고 나도 해줬다.
실행 명령어는 mysql이 아닙니다 ~
mysql -uroot -p 를 사용해서 로그인 하시면 됩니다 ~
C:\Users\user\Downloads\realmysql80-main\realmysql80-main>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.41 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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 employees;
Database changed
mysql> source employees.sql;
Query OK, 0 rows affected (0.00 sec)
넵 이 상태로 아까 에러가 났던 명령어를 입력해줍니다.
잘 되더라구요 ㅎㅎ 덕분에 정리까지 했습니다. 감사해요 선생님
지금 생각한건데 ...
중간고사 치고 모든 걸 까먹은 듯 ....
MySQL DB 예제소스파일 불러오기(feat.cmd)
원하는 예제 소스 파일 다운로드 후 cmd로 소스파일 불러오기 관리자 권한으로 cmd실행 후 소스파일로 이동 > cd (소스파일 위치) mysql 접속 명령어 > mysql -u root -p > 비밀번호 입력 해당 명령어 입력
dys-r.tistory.com