ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Install MySQL
    MySQL 2023. 6. 16. 00:25

    brew를 이용해서 설치를 시작해 보자

    brew install mysql
    !brew install이 안된다?

    ※당황하지말자!!
    본인은 M1 Mac 사용자다 터미널을 iterm을 이용해서 다운 받으려고 하자 brew을 찾을수 없다는 말을 듣고 당황하였다.

    export PATH=/opt/homebrew/bin:$PATH

    터미널에 이 명령어를 먼저 입력하자 그 후 brew install mysql을 해보자

     

    설치가 완료되면 서버를 실행을 위해 터미널에 아래와 같이 명령어를 입력하자

    brew services start mysql

    이 상태로도 사용 가능 하다 하지만 보안을 위해 비밀번호를 설정을 해보자

    비밀번호를 설정 하기위해 터미널에 아래와 같은 명령어를 입력해보자 

    mysql_secure_installation

    입력하면 복잡한 비밀번호를 사용할것이라는 문구와 함께 Y/N이 나온다 N을 입력하자

    New password: // 비밀번호를 입력하고 엔터를 쳐서 설정해준다.
    Re-enter new password: // 비밀번호를 다시 입력한다. 

    익명의 유저를 삭제하는데 동의하자

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

    n을 입력하여 root의 원격 접속을 허용하자

    Diasallow root login remotely?(press y | Y for Yes, any other key for No) : n

    n을 입력하여 test데이터베이스를 유지하자

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

    y를 입력해 변경된 권한을 테이블에 적용하자

    Reload privailege tabes now?(press y | Y for Yes, any other key for No) : y

    MySQL 접속 확인 

    mysql -u root -p

    입력하여 방금 설정한 비밀번호를 입력하면 접속이 되었다. 

    MySQL 연결 해제

    brew services stop mysql

     

Designed by Tistory.