mac mysql 설치

Homebrew

Posted by ETHAN KIM on November 01, 2021 · 3 mins read
Node.js

mysql 설치가 이전에 되어있을 경우 초기 삭제방법

터미널을 연 후,

  • homebrew로 설치했을때,
    • sudo rm -rf /usr/local/var/mysql
    • sudo rm -rf /usr/local/bin/mysql*
    • sudo rm -rf /usr/local/Cellar/mysql


  • MySQL 공식홈페이지의 파일로 설치했을때,
    • sudo rm -rf /usr/local/mysql
    • sudo rm -rf /Library/PreferencePanes/My*
    • sudo rm -rf /var/db/receipts/com.mysql.*

mac mysql homebrew 통해 설치하기

homebrew 설치 후


— 입력 —

~ brew install mysql


— 출력 —

homebrew update 필요시 update 후 mysql install 코드 실행


Enter password for user root:
Error: Access denied for user ‘root’@’localhost’ (using password: YES)

— 입력 — (초기설정 명령)

~ $mysql_secure_installation

— 출력 —

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.


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


PASSWORD 설정

New password:


PASSWORD 재입력

Re-enter new password:


익명 사용자 접속허용 여부 설정 ‘y’시 접속시 -u옵션 반드시 명시해야함

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.


외부 접속 허용여부

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) : n

… skipping.


설정변경 후 테이블 리로드 여부

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

All done!
~ $>….
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.


초기 테스트 db 삭제 필요 여부

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

  • Dropping test database…
    Success.

  • Removing privileges on test database… Success.

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 Success.

All done! ~ $