-
[MySQL] Install MySQL with Homebrew (Mac)DB/MySQL 2023. 2. 7. 22:24
1. 터미널 실행
brew update brew install mysql
-> 결과
==> mysql We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -u root To restart mysql after an upgrade: brew services restart mysql Or, if you don't want/need a background service you can just run: /opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
2. root 비밀번호 초기화
mysql_secure_installation
-> 결과
Securing the MySQL server deployment. Enter password for user root: The 'validate_password' component is installed on the server. The subsequent steps will run with the existing configuration of the component. Using existing password for root. Estimated strength of the password: 50 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y New password: ... All done!
3. 실행
mysql -uroot -p{pwd} Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 24 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>
<!> 2002 , 2003 에러 발생할 경우 -> 재실행
-- ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/tmp/mysql.sock' (2) -- ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (61) brew services restart mysql
** 공식문서참고
'DB > MySQL' 카테고리의 다른 글
[MySQL] CentOS7 - Mysql 5.7 cmmand 설치 (0) 2021.06.21 ERROR 1049 (42000): Unknown database (0) 2021.05.26 The server time zone value ‘KST’ is unrecognized or represents more than one time zone. (0) 2019.12.05