MySQL 설치 방법
MySQL이란?
- 세계에서 가장 많이 쓰이는 오픈 소스의 관계형 데이터베이스 관리 시스템(RDBMS)이다.
* 관계형 데이터베이스 관리 시스템: 키(key)와 값(value)들의 간단한 관계를 테이블화 시킨 매우 간단한 원칙의 전산정보 데이터베이스이다.
(출처: 위키피디아(wikipedia)
설치 방법
1. brew -v 명령어로 brew의 버전을 확인한다.
(설치는 brew로 진행하므로 brew가 설치되지 않았다면 https://develop-grow.tistory.com/entry/MacOS-Homebrew-설치-방법 을 참고한다.)
2. brew update 명령어로 brew의 버전을 최신버전으로 업데이트 한다.
3. brew search mysql 명령어로 mysql 패키지 확인한다.
4. brew install mysql 명령어로 mysql 패키지 설치한다.
5. 설치가 완료되었다면 brew list | grep mysql 명령어로 mysql 패키지 설치를 확인한다.
초기 설정
1. mysql.server start 로 MySQL을 실행시킨다.
macmini@macminiui-Macmini ~ % mysql.server start
Starting MySQL
.. SUCCESS!
2. mysql_secure_installation 로 설정 실행
2-1. 비밀번호 복잡성 설정 (복잡성O -> 'Y', 복잡성X -> 'N')
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: n
2-2. root 계정의 password 설정
Please set the password for root here.
New password:
Re-enter new password:
2-3. Remove anonymous users? 사용자에 대한 설정을 묻는다.
- Yes 일 경우 : -u(user) 옵션 필요 ex) mysql -u root -p
- No 일 경우 : -u(user) 옵션 필요 없음 ex) mysql
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) : y
2-4. root 계정을 localhost에서만 사용할 것인가?
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) : y
2-5. test DB 를 삭제할 것인가?
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) : y
- Dropping test database...
2-6. 권한 테이블을 reload할 것인가?
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) : y
2-7. All done! 문구가 나오면 설정 완료!
2-8. mysql -u root -p 명령어로 접속 확인 -> 프롬프트에 mysql 문구가 나오면 접속 성공!
마무리
- homebrew를 이용하여 mysql 설치와 설정을 했다.
- 외부에서 서버의 데이터베이스를 접근할 수 있어야 하기 때문에 다음 글에서는 외부 접근 허용 과정을 적으려고 한다.
'개발환경구성' 카테고리의 다른 글
[MacOS] Apache, php 실행 및 사용자별 디렉토리 설정 (0) | 2021.12.27 |
---|---|
[MacOS] MySQL 외부 접근 허용 (0) | 2021.12.19 |
[MacOS] Homebrew 설치 방법 (0) | 2021.12.19 |
댓글