반응형
1. MySQL 설치하기 전
Mac 유저라면, mysql은 homebrew로 설치하는 것이 쉽다
- 터미널에서 homebrew가 있는지 확인
> brew -v
- 없다면 homebrew 설치
> /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2. MySQL 설치하기
> brew install mysql
3. MySQL 서버 열기
> brew services start mysql
4. MySQL 초기 설정하기
> mysql_secure_installation
초기 설정할 때 비밀번호 원하는 대로 셋팅하고 그 외 셋팅들은 보안을 위해서 Y로 셋팅함
5. MySQL 접속하기
> mysql -u root -p
비밀번호를 입력하고 나면 접속이 잘 됨
jeongjieun@jeongjieun-ui-MacBookPro ~ % mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.29 Homebrew
Copyright (c) 2000, 2022, 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>
mysql 종료시키고 싶으면 exit 입력하면 된다
mysql> exit
Bye
jeongjieun@jeongjieun-ui-MacBookPro ~ %
6. MySQL 서버 닫기
> mysql.server stop
1. DB 생성하기
mysql 서버가 열린 상태에서
DB를 생성하고 싶은 프로젝트의 Backend 폴더로 들어가서 아래 명령어 입력
> npx sequelize db:create
반응형