- [Mac M1 M2] 맥북에서 간단하게 MySQL 설치하고 실행하기2024년 02월 05일
- 주사위 clice
- 작성자
- 2024.02.05.:58
반응형5분만에 간단하게 맥북에서 돌고래를 키워보자
1. brew install cask
brew install cask
cask를 설치해준다
2. brew install openssl
brew install openssl
opensql 아니고 openssl이다
3. brew install mysql
brew install mysql
이제 mysql 설치를 해준다
4. mysql.server start
mysql.server start
서버 시동을 켜준다
혹시 여기서
ERROR! The server quit without updating PID
라는 에러가 난다면 라는 다음 게시글 참고하자: https://clice.tistory.com/entry/MySQL-에러ERROR-The-server-quit-without-updating-PIDbase-해결하기
[MySQL]에러 ERROR! The server quit without updating PID 해결하기
혹시 이 방법으로도 해결이 되지 않는다면 mysql 버전이 여러개 설치 되어있을 수 있다 brew list로 설치되어 있는 mysql 버전을 확인해준다 여러개 깔려있거나 너무 옛날 버전이 깔려있다면 brew uninst
clice.tistory.com
5. mysql_secure_installation
mysql_secure_installation
계속 설치를 해준다
그러면 이제 몇가지 질문이 나오는데 이 질문들에 적절히 응답하며 기본 세팅을 해준다
6. 질문에 답하며 기본 세팅
Would you like to setup VALIDATE PASSWORD component?
Would you like to setup VALIDATE PASSWORD component?
>비밀번호 설정하는 항목이다
NO: 간단한 비밀번호 YES: 복잡한 비밀번호
필요에 맞게 설정하면 된다
비밀번호는 꼭 다른 곳에 기억해두자
Remove anonymous users? (Press y|Y for yes, any other key for No): Yes
Remove anonymous users? (Press y|Y for yes, any other key for No): Yes사용자 설정에 관한 옵션이다
-u를 옵션으로 주고 로그인 할지 말지에 관한 질문이다
-u로 로그인할거면 YES를 입력한다
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 ylY for Yes, any other key for No) : Yes
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 ylY for Yes, any other key for No) : Yes
원격 접속에서 root 로그인을 허용할 것인지에 대한 질문이다
필요에 맞게 YES/ NO를 입력하자
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 yIY 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 yIY for Yes, any other key for No) : YES
테스트 DB를 유지할것인지 말것인지에 관한 질문이다
YES해도 딱히 뭐가 없어서 그냥 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) : 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) : Yes
변경된 내용을 바로 적용할지 말지에 관한 질문이다
YES를 입력하면 된다
MySQL 접속 확인 및 명령어 확인
이제 MySQL 접속이 잘 되는지 확인을 해보자
7. mysql -u root -p :mysql 접속
mysql -u root -p
위 코드는 root 권한 접속이다
위 코드를 입력하면 비밀번호를 묻는 항목이 나온다아까 설정한 비밀번호를 입력해준다
8. mysql 상태를 확인하려면 status, mysql에서 나오려면 exit
status
exit
필요에 맞게 사용하면 되는 명령어이다
9. mysql.server stop
mysql.server stop
위에서 exit을 해줘도, 그냥 mysql에서 나온거라 서버 시동을 끄려면 위 명령어를 입력해준다
MySQLWorkbench 설치
이제 본격적으로 Workbench를 설치해보자
10. brew install mysql-client
brew install mysql-client
11. brew install mysqlworkbrench —cask
brew install mysqlworkbrench —cask
MySQLWorkbench 설치
mysql 사용하기
12. 서버 시동 켜기
mysql. server start mysql -u root -p
사용을 위해 터미널에 위 항목을 차례로 입력해주고 서버를 스타트 해준다
mysql. server start
mysql -u root -p
13. mysql 실행
앱 목록에서 MySQLWorkbench를 찾아 실행해준다
그러면 이런 화면이 나온다
+버튼을 눌러 새로운 서버랑 연결해준다
그럼 이런 화면이 나온다
connection name: 알아보기 쉽게 서버에 닉네임 붙이는 것이다
그냥 파일 명이라고 생각하면 쉽다
hostname: 서버 IP 주소이다
로컬이라 저런 형식으로 나왔다
port: 포트번호
mysql에서 지정해준 포트번호이다
여기에 아까 설정한 비밀번호를 입력하면 내 서버에 연결할 수 있다
14. MySQL 서버 시동 끄기
mysql을 당장 사용하지 않는다면 꼭 터미널에서
exit mysql.server stop
위 명령어를 입력해서
서버 시동을 꺼주자
끝!
반응형'서버 > MySQL' 카테고리의 다른 글
[MySQL]에러 ERROR! The server quit without updating PID 해결하기 (0) 2024.02.05 다음글이전글이전 글이 없습니다.댓글