[MySQL] Mac에서 mysql 삭제 후 재설치

Jiwon-Woo·2021년 9월 7일
1

MySQL

목록 보기
1/3

boostcourse 웹 백엔드 SQL & JDBC 프로그래밍

mysql 설치 및 실행하기

# mysql 설치
$ brew install mysql

# MySQL 서버 실행
$ mysql.server start
 
# MySQL을 데몬으로 실행
$ brew services start mysql

# MySQL을 데몬으로 재실행
$ brew services restart mysql

# 데몬으로 실행되고 있는 프로그램들 확인하기
$ brew services list

강의가 제시한 절차에 따라 mysql을 설치했는데, 아래처럼 데몬버전으로 실행할 때 자꾸 error 가 떴다.

$ brew services start mysql

==> Successfully started `mysql` (label: homebrew.mxcl.mysql)
$ brew services list

256
Name        Status  User     Plist
mysql       error   jwoo     /usr/local/opt/mysql/homebrew.mxcl.mysql.plist

OS X에서 MySQL을 잘못 설치했을 때 다시 설치하는 방법

그래서 위의 링크를 참고하여 삭제 후 재설치를 진행하였다. (만약의 사태를 대비하여 필요한 경우 데이터를 백업해둔다.)

mysql의 디렉토리 확인

$ ls -al /usr/local/var/mysql

mysql 실행중지

$ brew services stop mysql

$ brew services list

Name        Status  User Plist
mysql       stopped

mysql 디렉토리 삭제 및 uninstall

$ rm -rf /usr/local/var/mysql

$ brew uninstall mysql
Uninstalling /usr/local/Cellar/mysql/8.0.26... (304 files, 296.5MB)

mysql 재설치

brew install mysql

mysql 데몬 실행해보기

$ brew services list

Name        Status  User Plist
mysql       stopped


$ brew services start mysql

==> Successfully started `mysql` (label: homebrew.mxcl.mysql)


$ brew services list

Name        Status  User     Plist
mysql       started jwoo     /Users/jwoo/Library/LaunchAgents/homebrew.mxcl.mysql.plist

mysql 종료하기

# mysql.server start 로 실행한 경우
$ mysql.server stop

# brew services start mysql 로 데몬 실행한 경우
$ brew services stop mysql

0개의 댓글