์ž๋™์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” mysql ๋ฐ๋ชฌํ”„๋กœ์„ธ์Šค ๊ฐ•์ œ์ข…๋ฃŒ

MySQL 8 ๋ฒ„์ „(mysql-8.0.20-macos10.15)์„ MacOS 10.14 (Mojave) ์— ์„ค์น˜ํ–ˆ๋‹ค. ์„ค์น˜๋Š” CE๋ฒ„์ „ dmg ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์•„์„œ ํ–ˆ๋Š”๋ฐ, ์„ค์น˜ํ•  ๋•Œ ๋งˆ์ง€๋ง‰์— ์ธ์Šคํ†จ ํ”„๋กœ์„ธ์Šค ์ข…๋ฃŒ ํ›„ ์ž๋™์œผ๋กœ MySQL์„ ์‹œ์ž‘ํ• ๊ฑด์ง€์— ๋Œ€ํ•œ ์ฒดํฌ๋ฅผ ํ•ด์ œํ•˜์ง€ ์•Š๊ณ  finishํ–ˆ๊ณ , MAMP๊ฐ€ ์‹คํ–‰๋˜์ง€ ์•Š๊ธธ๋ž˜(ํŒ์—…์ฐฝ์ด ๋œจ์ง€ ์•Š๊ธธ๋ž˜) ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์ˆ˜๋™์œผ๋กœ ์‹คํ–‰์„ ์‹œ์ผฐ๋Š”๋ฐ nginx ์„œ๋ฒ„๋งŒ ๋œจ๊ณ  mysql ์„œ๋ฒ„๊ฐ€ ๋œจ์ง€ ์•Š์•˜๋‹ค.

์˜ค๋žœ๋งŒ์— MAMP๋ฅผ ์“ฐ๋ ค๋‹ค๋ณด๋‹ˆ ์™œ ์•ˆ๋œจ๋Š”์ง€ ์›์ธ์„ ์ฐพ๊ธฐ๊ฐ€ ํž˜๋“ค์–ด์„œ ์ •๋ฆฌํ•ด๋ณธ๋‹ค.

์ผ๋‹จ mysql ์„œ๋ฒ„์˜ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•ด๋ณด๋ ค ํ–ˆ๋‹ค. ๋กœ๊ทธ ์œ„์น˜๊ฐ€ ์–ด๋””์ธ์ง€๋ฅผ ๋ชฐ๋ผ์„œ ๊ทธ๋ƒฅ find ๋ช…๋ น์–ด๋กœ mysql*.log ํŒŒ์ผ์„ ์ฐพ์œผ๋ คํ–ˆ๋Š”๋ฐ ์•ˆ๋‚˜์˜จ๋‹ค -_-; ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค๋”๋‹ˆ .err ํ™•์žฅ์ž๋กœ ๋๋‚˜๋Š” ํŒŒ์ผ์ด MAMP ์•ˆ์— log ๋””๋ ‰ํ† ๋ฆฌ ์•ˆ์— ์žˆ์—ˆ๊ณ (ํŒŒ์ผ๋ช…์€ mysql_error_log.err ์ด๋‹ค) ํ•ด๋‹น ํŒŒ์ผ์„ ์—ด์–ด์„œ ์—๋Ÿฌ๋ฉ”์‹œ์ง€๋ฅผ ํ™•์ธํ–ˆ๋”๋‹ˆ ํ•ด๋‹น ํฌํŠธ๊ฐ€ ์ด๋ฏธ ์‚ฌ์šฉ์ค‘์ด๋ž€๋‹ค. ์˜ค์ž‰? ๊ทธ๋Ÿผ ์„ค์น˜ํ›„์— ์‹คํ–‰์ด ๋๋‹ค๋Š” ์–˜๊ธด๊ฐ€??? ๊ทธ๋ž˜์„œ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ™•์ธํ•ด๋ณด์•˜๋‹ค.

ps -ef|grep mysql

๊ทธ๋žฌ๋”๋‹ˆ mysql ๋ฐ๋ชฌ์ด ์ด๋ฏธ ๋– ์žˆ๋‹ค. ์‹คํ–‰์‹œํ‚จ ์œ ์ €๋Š” _mysql ์ด๋ผ๊ณ  ๋˜์–ด์žˆ์—ˆ๊ณ  ์ด ํ”„๋กœ์„ธ์Šค๋ฅผ ๋„๊ณ  ๋‹ค์‹œ MAMP๋ฅผ ์‹คํ–‰์‹œ์ผœ์„œ mysql ์„œ๋ฒ„๋ฅผ ๋„์šฐ๋ ค๊ณ  kill -9 PID๋ฅผ ์‹คํ–‰์‹œ์ผฐ๋Š”๋ฐ ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค๋Š” ๊บผ์กŒ์œผ๋‚˜ ๋‹ค๋ฅธ PID๋ฅผ ๊ฐ–๋Š” mysql๋ฐ๋ชฌ์ด ์ž๋™์œผ๋กœ ์‹คํ–‰์ด ๋˜์–ด์žˆ์—ˆ๋‹ค. ใ…กใ…ก;

๋ญ์ง€?? ์–˜ ์ข€๋น„๋„ค? ๋‹ค์‹œ ์—ด์‹ฌํžˆ ๊ตฌ๊ธ€๋ง์„ ํ•ด์„œ ๋™์ผํ•œ ๋ฌธ์ œ์— ๋Œ€ํ•ด ์„ค๋ช…์„ ์ž˜ ํ•ด๋†“์€ ๋ฏธ๋””์—„ ํฌ์ŠคํŒ…์„ ํ•˜๋‚˜ ์ฐพ์•˜๋‹ค. ๋ฐ”๋กœ ์—ฌ๊ธฐ์ด๋‹ค. ํ•ด๋‹น ์‚ฌ์ดํŠธ์—์„œ๋Š” mysql-8.0.12-macos10.13 ๋ฒ„์ „์— ๋Œ€ํ•œ ์„ค๋ช…์ด ์žˆ์—ˆ๊ณ  ๋‚ด๊ฐ€ ์„ค์น˜ํ•œ ๋ฒ„์ „์€ mysql-8.0.20-macos10.15 ๋ฒ„์ „์ด์—ˆ๋‹ค. ์•„๋งˆ macOS ๋ฒ„์ „๋„ ๋‹ค๋ฅด์ง€ ์•Š์„๊นŒ ์‹ถ์€๋ฐ ์•„๋ฌดํŠผ ์ € ์‚ฌ์ดํŠธ์˜ ์„ค๋ช…๋Œ€๋กœ ํ•ด๋„ ํ•ด๋‹น ํ”„๋กœ์„ธ์Šค๋Š” ์ฃฝ์—ˆ๋‹ค ์‚ด์•„๋‚˜๊ณ  ์ฃฝ์—ˆ๋‹ค ์‚ด์•„๋‚˜๊ณ ๋ฅผ ๋ฐ˜๋ณตํ–ˆ๋‹ค.


๊ทธ๋ž˜์„œ ์ข€ ๋” ๊ตฌ๊ธ€๋ง์„ ํ•˜์—ฌ MySQL ๊ณต์‹ ๋ฌธ์„œ ์ค‘ MySQL launch daemon์— ๊ด€ํ•œ ๋ฌธ์„œ๋ฅผ ๋ณด๊ฒŒ ๋˜์—ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์„œ์—๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ ๋‚ด์šฉ์ด ์žˆ์—ˆ๋‹ค.

2.4.3 Installing and Using the MySQL Launch Daemon
macOS uses launch daemons to automatically start, stop, and manage processes 
and applications such as MySQL.

By default, the installation package (DMG) on macOS installs a launchd file named 
/Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist that contains a plist 
definition similar to:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>             <string>com.oracle.oss.mysql.mysqld</string>
    <key>ProcessType</key>       <string>Interactive</string>
    <key>Disabled</key>          <false/>
    <key>RunAtLoad</key>         <true/>
    <key>KeepAlive</key>         <true/>
    <key>SessionCreate</key>     <true/>
    <key>LaunchOnlyOnce</key>    <false/>
    <key>UserName</key>          <string>_mysql</string>
    <key>GroupName</key>         <string>_mysql</string>
    <key>ExitTimeOut</key>       <integer>600</integer>
    <key>Program</key>           <string>/usr/local/mysql/bin/mysqld</string>
    <key>ProgramArguments</key>
        <array>
            <string>/usr/local/mysql/bin/mysqld</string>
            <string>--user=_mysql</string>
            <string>--basedir=/usr/local/mysql</string>
            <string>--datadir=/usr/local/mysql/data</string>
            <string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
            <string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
            <string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
            <string>--keyring-file-data=/usr/local/mysql/keyring/keyring</string>
            <string>--early-plugin-load=keyring_file=keyring_file.so</string>
        </array>
    <key>WorkingDirectory</key>  <string>/usr/local/mysql</string>
</dict>
</plist>

์ฆ‰, mysql์„ ์„ค์น˜ํ•˜๋ฉด /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist ํŒŒ์ผ์— ์œ„์™€ ๊ฐ™์€ ์„ค์ • ๋‚ด์šฉ์ด ๋“ค์–ด์žˆ๋‹ค๋Š” ๋‚ด์šฉ์ด์—ˆ๊ณ  ์„ค์ • ํ•ญ๋ชฉ๋“ค ์ค‘์— ์ž๋™์‹คํ–‰๊ณผ ๊ด€๋ จ๋œ ํ•ญ๋ชฉ์ด ์žˆ์„๊นŒ ์‹ถ์–ด ์ญˆ์šฑ ํ›‘์–ด๋ณด๋‹ˆ RunAtLoad ์™€ LaunchOnlyOnce ํ•ญ๋ชฉ์ด ๋ˆˆ์— ๋„์—ˆ๋‹ค.
์ผ๋‹จ ๋‘˜๋‹ค ๊ธฐ๋ณธ๊ฐ’๊ณผ ๋ฐ˜๋Œ€๋กœ ์„ค์ •ํ•˜์—ฌ RunAtLoad ๊ฐ’์€ false๋กœ, LaunchOnlyOnce์˜ ๊ฐ’์€ true๋กœ ์ˆ˜์ •ํ•ด์„œ ์ €์žฅํ•˜๊ณ  ๋‹ค์‹œ kill์„ ํ•ด๋ณด์•˜๋‹ค. (์ด ๊ณผ์ •์—์„œ ์žฌ๋ถ€ํŒ…์„ ํ–ˆ์—ˆ๋Š”์ง€ ์ •ํ™•ํžˆ ๊ธฐ์–ต์ด ๋‚˜์ง€๋Š” ์•Š๋Š”๋‹ค;; ์•ˆํ–ˆ๋˜๊ฒƒ ๊ฐ™์€๋ฐ..^^; ) ๊ทธ๋žฌ๋”๋‹ˆ ๋”์ด์ƒ ์ž๋™์œผ๋กœ ์‹คํ–‰๋˜์ง€ ์•Š์•˜๊ณ , MAMP๋ฅผ ์‹คํ–‰์‹œ์ผœ์„œ mysql ์„œ๋ฒ„๋ฅผ startํ•˜๋‹ˆ ์ด์ œ ์ž˜ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.
 

๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๊พธ~~์šฑ~~