[MacOS] Mysql ์ค์น ๋ฐฉ๋ฒ
homebrew๋ก MySQL ํจํค์ง ์ค์น ๋ฐฉ๋ฒPermalink
MySQL ํจํค์ง ๊ฒ์Permalink
> brew search mysql
==> Formulae
automysqlbackup mysql-client mysql-sandbox mysql@5.7
mysql mysql-client@5.7 mysql-search-replace mysqltuner
mysql++ mysql-connector-c++ mysql@5.6 qt-mysql
==> Casks
mysql-connector-python mysql-utilities navicat-for-mysql
mysql-shell mysqlworkbench โ sqlpro-for-mysql
MySQL ์ค์น ๋ฐฉ๋ฒPermalink
brew install mysql
: ์ต์ mysql ํจํค์ง๋ฅผ ๋ค์ด๋ฐ์ ์ ์์ต๋๋ค.brew install mysql@5.7
: mysql 5.7๋ฒ์ ํจํค์ง๋ฅผ ๋ค์ด๋ฐ์ ์ ์์ต๋๋ค.
mysql@๋ฒ์ : ์ํ๋ ๋ฒ์ ์ ์ ํํ์ฌ ๋ค์ด๋ฐ์ ์ ์์ต๋๋ค.
mysql@5.7์ ์ค์นํ์์ต๋๋ค.
MySQL ์ค์น ํ์ธ ๋ฐฉ๋ฒPermalink
brew list
๋ฅผ ํตํด ์ค์น๋ ํญ๋ชฉ์ ์กฐํํ ์ ์์ต๋๋ค.
> brew list
mysql@5.7
MySQL ์ญ์ ๋ฐฉ๋ฒPermalink
brew remove mysql@5.7
brew list
๋ฅผ ํตํด ์ญ์ ๋์๋์ง ํ์ธ์ด ๊ฐ๋ฅํฉ๋๋ค.
MySQL ์ค์ ๋ฐฉ๋ฒPermalink
ํ๊ฒฝ ๋ณ์ ์ถ๊ฐPermalink
- bash shell์ด ์๋ zsh shell์ ๊ธฐ์ค์ผ๋ก ์์ฑํ์์ต๋๋ค
> echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
ํ๊ฒฝ ๋ณ์ ์ ์ฉPermalink
> source ~/.zshrc
MySQL ์๋ฒ ์คํ/์ค์งPermalink
mysql.server start
๋ช
๋ น์ด๋ก MySQL ์๋ฒ๋ฅผ ์คํ์ํต๋๋ค.
> mysql.server start
Starting MySQL
SUCCESS!
mysql.server stop
๋ช
๋ น์ด๋ก MySQL ์๋ฒ๋ฅผ ์ค์ง์ํฌ ์ ์์ต๋๋ค.
MySQL ์ค์ Permalink
MySQL ์ค์ ์ ํ๊ธฐ ์ํด์๋ mysql_secure_installation
๋ช
๋ น์ด๋ฅผ ์
๋ ฅํฉ๋๋ค.
mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN 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 plugin?
Press y|Y for Yes, any other key for No:
๋น๋ฐ๋ฒํธ ์ ํ ์ ํPermalink
๋น๋ฐ๋ฒํธ ๊ฐ์ด๋ ์ค์ ์ ๋ํ ์ง๋ฌธ์ ๋๋ค.
Yes
: ๋ณต์กํ ๋น๋ฐ๋ฒํธ ์ค์ No
: ์ฌ์ด ๋น๋ฐ๋ฒํธ ์ค์
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: No
No
๋ฅผ ์ ํํ์ต๋๋ค.
๋น๋ฐ๋ฒํธ ์ค์ Permalink
์ฌ์ฉํ ์๋ก์ด ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํฉ๋๋ค.
Please set the password for root here.
New password:
Re-enter new password:
๋น๋ฐ๋ฒํธ๋ ๊ฐ๋จํ๊ฒ mysql
๋ก ํ์ต๋๋ค.
์ฌ์ฉ์ ์ค์ Permalink
Remove anonymous users? (Press y|Y for Yes. any other key for No)
์ฌ์ฉ์ ์ค์ ์ ํ๋ ๋ถ๋ถ์
๋๋ค.
Yes
: ์ ์ํ๋ ๊ฒฝ์ฐmysql -u root
์ฒ๋ผ -u ์ต์ ํ์No
: ์ ์ํ๋ ๊ฒฝ์ฐmysql
์ฒ๋ผ -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) : Yes
Yes
๋ฅผ ์ ํํ์ต๋๋ค.
์๊ฒฉ ์ ์ ์ค์ Permalink
Disallow root login remotely? (Press y|Y for Yes, any other key for No)
๋ค๋ฅธ IP์์ root ์์ด๋๋ก ์๊ฒฉ์ ์์ ํ์ฉํ๋์ง์ ๋ํ ์ค์ ์
๋๋ค.
Yes
: ์๊ฒฉ์ ์ ๋ถ๊ฐ๋ฅNo
: ์๊ฒฉ์ ์ ๊ฐ๋ฅ
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) : No
Yes
๋ฅผ ์ ํํ์ต๋๋ค.
TEST ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ค์ Permalink
Remove test database and access to it? (Press y|Y for Yes, any other key for No)
Test ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ค์ ํ๋ ์ง๋ฌธ์
๋๋ค
Yes
: Test ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ ๊ฑฐNo
: Test ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ ์ง
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.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Yes
Yes
๋ฅผ ์ ํํ์ต๋๋ค.
๋ณ๊ฒฝ๋ ๊ถํ์ ํ ์ด๋ธ์ ์ ์ฉํ๋ ์ค์ Permalink
Reload privilege tables now? (Press y|Y for Yes, any other key for No)
๋ณ๊ฒฝ๋ ๊ถํ์ ํ
์ด๋ธ์ ์ ์ฉํ๋ ์ค์ ์ ๋ํ ์ง๋ฌธ์
๋๋ค.
Yes
: ์ ์ฉ ์ํจ๋คNo
: ์ ์ฉ์ํค์ง ์๋๋ค
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) : Yes
Yes
๋ฅผ ์ ํํ์ต๋๋ค.
์ค์ ์๋ฃPermalink
- All done!์ด ๋จ๋ฉด ๋ชจ๋ ์ค์ ์ด ๋์ ๋๋ค.
MySQL DB ๋ก๊ทธ์ธ/๋ก๊ทธ์์Permalink
mysql -uroot -p
๋ช
๋ น์ด๋ฅผ ์
๋ ฅํ ์์์ ์ค์ ํ ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ ๋ก๊ทธ์ธํฉ๋๋ค.
> mysql -uroot -p
Enter password:
- ์ ์์ ์ผ๋ก ๋ก๊ทธ์ธ์ด ๋๋ฉด mysql> ๋์ต๋๋ค.
> mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.35 Homebrew
Copyright (c) 2000, 2021, 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>
mysql> ์์์ exit
or quit
๋ช
๋ น์ด๋ก ๋ก๊ทธ์์ํ ์ ์์ต๋๋ค.
mysql> exit or quit
Bye
MySQL ์คํ ์ ์ฐจPermalink
- MySQL ์๋ฒ ์์ :
mysql.server start
- MySQL DB ๋ก๊ทธ์ธ :
mysql -uroot -p
- MySQL DB ๋ก๊ทธ์์ :
exit ๋๋ quit
- MySQL ์๋ฒ ์ข
๋ฃ :
mysql.server stop
referencePermalink
macOS MySQL ์ค์น ๋ฐ ์ค์ ์ฌ์ฉ๋ฒ
MySQL ์ค์น์ ์ด๊ธฐ ์ค์ for macOS
MacOS brew๋ก mysql5.7 ์ค์น
mysql5.7 ๋ฒ์ homebrew ๋ก ์ค์น