이번에 처음 맥북을 산 기념으로 맥북에서 MySQL 설치하는 법을 포스팅 해보려고 합니다 :)
Homebrew 설치돠어 있지 않은 분들은 Homebrew 설치법 포스팅을 참고해주세요!
$ brew update
brew가 설치되어 있다면 업데이트를 해줍니다.
$ brew install mysql
위의 명령어를 입력하면, brew가 mySQL에 필요한 파일들을 설치해줍니다.
$ mysql_secure_installation
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
New password:
Re-enter new password:
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
만약 재설정 하고 싶다면 언제든지 "mysql_secure_installation" 명령어를 입력해서 다시 설정하면 됩니다.
실행하기
mysql.server start // 서버 시작
mysql -uroot -p // 비밀번호 입력 후 MySQL 접속
종료하기
\q // MySQL 종료
mysql.server stop // 서버 종료