๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

OS/๐ŸŽ MacOS

MacOS * mysql ์„ค์น˜ ( feat. home brew )

์„ค์น˜๋งŒ ํ•˜๊ณ  ๋ฐ”๋กœ ์ ‘์†์„ ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ๋ช‡ ๊ฐ€์ง€ ์„ค์ •์„ ํ•ด์ฃผ๋Š” ๊ฒƒ์„ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

์ ‘์†ํ•˜์…”์„œ ์„ค์ •ํ•˜์…”์„œ mysql ๋ช…๋ น์–ด๋กœ ์„ค์ •์„ ์ˆ˜์ •ํ•˜์…”๋„ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค.

 

 

์„ค์น˜ํ•˜๊ธฐ
> brew install mysql

 

 

 

์„ค์ •ํ•˜๊ธฐ

mysql์— ๋Œ€ํ•œ ์„ค์ •์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

> mysql_secure_installation

1. ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณต์žก์„ฑ์— ๋Œ€ํ•ด ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  • 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:
Press y|Y for Yes, any other key for No: No

2. root์— ๋Œ€ํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

Please set the password for root here.

New password:

Re-enter new password:

3. ์ต๋ช… ์‚ฌ์šฉ์ž ์ œ๊ฑฐ?? ๋ผ๊ณ  ํ•˜๋Š”๋ฐ ์ ‘์†์„ ํ•  ๋•Œ -u ์˜ต์…˜์„ ์“ธ์ง€ ์•ˆ ์“ธ์ง€๋ฅผ ์„ค์ •ํ•œ๋‹ค.

  • Yes: -u ์˜ต์…˜์„ ๋ถ™์—ฌ์„œ ์ ‘์† ํ•  ๋Œ€์ƒ์„ ์ง€์ •ํ•œ๋‹ค. ex) mysql -u root -p
  • No: -u ์˜ต์…˜์„ ๋ถ™์ด์ง€ ์•Š๊ณ  ์ ‘์†ํ•œ๋‹ค. ex) mysql
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) :
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Yes

4. localhost์—์„œ๋งŒ root์— ๋Œ€ํ•œ ์›๊ฒฉ ์ ‘์†์„ ํ—ˆ์šฉ ํ•  ์ง€ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

  • Yes: localhost์™ธ์— ๋‹ค๋ฅธ IP์—์„œ root ๊ณ„์ •์œผ๋กœ ์›๊ฒฉ ์ ‘์†์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค.
  • No: localhost์™ธ์— ๋‹ค๋ฅธ IP์—์„œ root ๊ณ„์ •์œผ๋กœ ์›๊ฒฉ ์ ‘์†์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

 

์งˆ๋ฌธ์ด Disallow root login remotely ์ž„์œผ๋กœ localhost ์™ธ์— ๋‹ค๋ฅธ ๊ณณ์—์„œ ์ ‘์† ํ•˜๋ ค๋ฉด 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) :
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : No

5. Test database๋ฅผ ์ œ๊ฑฐ ํ•  ์ง€ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

  • Yes: test database์™€ ์ ‘๊ทผ ๊ถŒํ•œ(?)์„ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.
  • No: test database์™€ ์ ‘๊ทผ ๊ถŒํ•œ(?)์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
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) :
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Yes

6. ๋ณ€๊ฒฝ ๋œ ๊ถŒํ•œ์„ ํ…Œ์ด๋ธ”์— ์ ์šฉํ• ์ง€ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

  • 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) :
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Yes

7. ๋!

 

 

 

 


Thanks for ๐Ÿ™ˆ