macOS
1. 설치
brew install mysql
2. 설치 후 비밀번호 설정
mysql_secure_installation
Mysql 설치 후 이 명령어로 비밀번호를 설정하는 것이 좋다.
(다른 방식으로 설정하면 안 되는 경우도 존재)
1) 질문들
1 비밀번호 복잡도에 대한 질문 - n
- 당연히 실서버에서 사용되는 비밀번호는 y
2 root 계정 비밀번호 설정 - y
3 익명 사용자 삭제 여부 y : 즉 -u 옵션을 통해서 mysql에 접근해야 한다.
4 root 계정의 원격 접속 허용 여부 - n (허용)
5 test database 삭제 여부 : y
6 설정 사항 반영여부 : y
3. 접속
mysql -u root -p
4. run server
mysql.server start
mysql.server stop
5. 에러 처리 - brew install mysql 한 후 접속이 안되는 문제.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
https://stackoverflow.com/questions/4359131/brew-install-mysql-on-macos
brew install mysql on macOS
I'm trying to setup up MySQL on mac os 10.6 using Homebrew by brew install mysql 5.1.52. Everything goes well and I am also successful with the mysql_install_db. However when I try to connect to the
stackoverflow.com
여기에 나와있는 곳에서
- ps -ax | grep mysql
- stop and kill any MySQL processes
- sudo rm /usr/local/mysql
- sudo rm -rf /usr/local/var/mysql
- sudo rm -rf /usr/local/mysql*
- sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
- sudo rm -rf /Library/StartupItems/MySQLCOM
- sudo rm -rf /Library/PreferencePanes/My*
- launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
- edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
- rm -rf ~/Library/PreferencePanes/My*
- sudo rm -rf /Library/Receipts/mysql*
- sudo rm -rf /Library/Receipts/MySQL*
- sudo rm -rf /private/var/db/receipts/*mysql*
- sudo rm -rf /tmp/mysql*
이걸 쭉 해주고,
- brew doctor and fix any errors
- brew remove mysql
- brew cleanup
- brew update
- brew install mysql
- unset TMPDIR
이걸 진행한다면, 정상적으로 잘 될 것이다.
1) 이 에러가 나는 이유
먼가 설정된 것이 완전히 삭제가 되지 않아서이다. 즉, 전에 설정된 파일을 완전히 삭제를 한 후, mysql을 다운받아준다면, 정상적으로 다시 사용할 수 있다.
'Database > MySQL' 카테고리의 다른 글
데이터베이스 반정규화(Denormalization) (0) | 2022.05.23 |
---|---|
데이터베이스 정규화(Normalization) (0) | 2022.05.23 |
트랜잭션 특징 (0) | 2022.05.07 |
PK, FK 특징 (0) | 2022.05.07 |
MySQL (0) | 2021.11.09 |