[Mac OS] MySQL 설치 및 세팅
MySQL 설치 과정은 Homewbrew가 설치되어있어야 한다. Homebrew 설치 방법은 [Mac OS] Git 설치 및 환경설정 글에 설명해 놓았으니 참고 바란다.
1. MySQL 설치
1-1. MySQL 설치 명령어 실행
아래 설치 명령어를 실행해 준다. 단, 특정 버전의 MySQL 설치가 필요하신 분들은 명령어 뒤에 @5.7
처럼 버전을 명시해 준다.
# 최신 버전 MySQL 설치
brew install mysql
# 특정 버전 MySQL 설치(5.7)
brew install mysql@5.7
Caverts(주의사항)을 보면 root 계정 비밀번호 설정 없이 MySQL만 설치되었다고 나오고, mysql_secure_installation
을 통해 설정을 마무리하라고 나온다. 또한 시작 프로세스에 등록하여 부팅 시 MySQL을 자동으로 실행해 주는 명령어(brew services start mysql
)도 안내해주고 있다. 부팅마다 자동으로 MySQL을 실행하길 원한다면 해당 명령어를 실행시켜 주면 된다.
나는 필요시 직접 MySQL을 실행시켜서 사용할 것이기에 해당 명령어를 생략하였다.
직접 실행, 종료를 아래 명령어를 사용하면 된다.
# MySQL 실행
mysql.server start
# MySQL 종료
mysql.server stop
2. mysql_secure_installation 설정
mysql_secure_installation
명령어를 실행시켜 준다.
2-1. 비밀번호 복잡도 검사
첫 번째 설정으로 비밀번호 복잡도 검사 시 어떤 방법으로 검사할지 묻는다. 복잡도를 선택하는 선택지가 있으므로 선택하면 된다.(0~3)
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. 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 component?
Press y|Y for Yes, any other key for No
2-2. 익명의 사용자 삭제 여부
익명의 사용자를 삭제할 것인지 묻는다. 초기 세팅이므로 Yes를 선택해 준다.
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)
2-3. root 계정 원격 접속 여부
root 계정을 원격에서의 접속을 차단할 것인지 묻는다. 일반적으로 root 계정은 원격 접속을 허용하지 않는 것이 좋으므로 Yes를 선택하여 차단하도록 하자. 원격작업이 필요한 경우 root 계정이 아닌 DB 계정을 생성하여 원격 권한을 주는 것이 바람직하다.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No)
2-4. 테스트 데이터베이스 삭제 여부
테스트 데이터베이스 삭제할 것인지 묻는다. 필요 없으니 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)
2-5 현재까지의 변경사항 즉시 적용 여부
위에서 선택한 사항들을 즉시 적용할지 묻는다. Yes를 통해 변경사항을 즉시 적용시켜 준다.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No)
'Setting' 카테고리의 다른 글
[Mac OS] Git 설치 및 환경설정 (2) | 2024.11.03 |
---|