[Database] MySQL 설치

ggg9_·2020년 10월 3일
0

저는 mac을 사용중입니다.

MySQL 설치

brew install mysql

# HomeBrew 패키지 관리자를 사용하지 않을 경우👇
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

MySQL 설정

mysql.server start 

mysql_secure_installation # 기본 설정 시작
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve securitNy. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
👉 비밀번호 복잡도 검사 과정 No

Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve securitNy. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
👉 루트 비밀번호 설정

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) :
👉 익명 사용자 삭제 여부 Yes

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
👉 test 데이터베이스 삭제 여부 No

Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
👉 변경된 권한 테이블에 적용 Yes
# mysql 서버가 재부팅과 상관없이 켜져있도록
brew services start mysql

MySQL 사용

mysql -u root -p 
  • -u 사용자 아이디 명시(여기서는 root 사용자)
    -p 비밀번호를 직접 입력하겠다는 옵션
# 비밀번호 변경
mysql > use mysql;
mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
mysql > FLUSH PRIVILEGES;
pip install mysqlclient # Django와 연결

0개의 댓글