[DB설치] 맥북에서 brew로 mysql설치하기

youuu·2023년 3월 21일
0

brew 설치가 되어 있어야한다.


1.🍋 설치

터미널에서 순서대로 진행한다

  1. mysql 설치 : brew install mysql
  • 입력하면 아래처럼 돌아가면서 설치가 된다.
~ % brew install mysql
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%

  1. 설치가 완료 된후 버전 확인 : mysql -V
  • Ver 8.0.32
~ % mysql -V
mysql  Ver 8.0.32 for macos12.6 on arm64 (Homebrew)

  1. 실행해보기 : mysql.server start
  • SUCCESS! 가 나오면 성공!
% mysql.server start
Starting MySQL
. SUCCESS!

mysql 자체를 내리고 싶을때

mysql.server stop


2.🍋 세팅

  1. 비밀번호 설정하기 : mysql_secure_installation
  • 입력하면 아래 처럼 나온다.
  • 복잡한 비밀번호 사용 -> y / 아니면 -> n(또는 아무키)
    • 나는 간단한 키를 사용하려고 no 입력했다.
% mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

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
Please set the password for root here.

  1. 비밀번호 입력하기
New password:

Re-enter new password:

  1. 기본적으로 만들어지는 익명유저를 삭제. -> y
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
Success.

  1. 원격에서 root로 로그인하는 것을 막는지?
  • 테스트용 DB이므로 원격 로그인을 막는다 -> y
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

  1. 테스트용 DB를 지울껀지?
  • 테스트 데이터를 사용하면 -> n
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

  1. All done! 하고 종료!
  • 설정을 다시 할꺼면 mysql_secure_installation를 입력한다.


3.🍋 실행

  1. mysql -u root -p를 입력하고 계정 비밀번호를 입력한다.
% mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.32 Homebrew

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

연결 확인 후 dbeaver에서 등록해줬다.

profile
공부중인 주니어 개발자

0개의 댓글