[macOS] 맥북 MySQL 설치

서링·2023년 3월 5일
0
post-thumbnail

이번에 처음 맥북을 산 기념으로 맥북에서 MySQL 설치하는 법을 포스팅 해보려고 합니다 :)


1. Homebrew 업데이트

Homebrew 설치돠어 있지 않은 분들은 Homebrew 설치법 포스팅을 참고해주세요!

$ brew update

brew가 설치되어 있다면 업데이트를 해줍니다.


2. MySQL 설치

$ brew install mysql

위의 명령어를 입력하면, brew가 mySQL에 필요한 파일들을 설치해줍니다.


3. MySQL 보안 설정

$ mysql_secure_installation

1. 처음에 비밀번호 보안을 강화할건지 묻습니다. 저는 간단한 비밀번호를 사용할 것이므로 No 를 입력했습니다. 만약 복잡한 비밀번호를 만들거면 y를 하면 됩니다.

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: No

2. 그 다음 MySQL 실행 시 사용할 비밀번호를 적습니다.

New password: 

Re-enter new password: 

3. 기본적으로 생성되는 익명 유저를 삭제할건지 묻습니다.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

4. 원격 로그인을 불허할건지 묻습니다.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) :  y

5. 테스트용 데이터베이스를 삭제할건지 묻습니다.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) :  y

6. 설정을 테이블에 바로 적용시킬건지 묻습니다.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

만약 재설정 하고 싶다면 언제든지 "mysql_secure_installation" 명령어를 입력해서 다시 설정하면 됩니다.


4. MySQL 사용법

실행하기

mysql.server start	// 서버 시작
mysql -uroot -p	// 비밀번호 입력 후 MySQL 접속

종료하기

\q	// MySQL 종료
mysql.server stop	// 서버 종료
profile
매일매일 성장하는 개발자 ✨🏃‍♀️

0개의 댓글