- @참고 : https://dev.mysql.com/doc/refman/8.0/en/osx-installation-launchd.html

 

MySQL :: MySQL 8.0 Reference Manual :: 2.4.3 Installing and Using the 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/Launc

dev.mysql.com

- @MySQL 5.5 Ref 참고2 : https://dev.mysql.com/doc/refman/5.5/en/osx-installation-launchd.html

 

MySQL :: MySQL 5.5 Reference Manual :: 2.4.3 Installing a MySQL Launch Daemon

2.4.3 Installing a MySQL Launch Daemon OS X uses launch daemons to automatically start, stop, and manage processes and applications such as MySQL. Note Before MySQL 5.5.45, the OS X builds installed startup items instead of launchd daemons. However, startu

dev.mysql.com

macOS는 실행 데몬(launch daemons)을 사용하여 자동적으로 시작, 중지 및 MySQL과 같은 프로세스와 어플리케이션을 관리합니다.

기본적으로, macOS에 대한 설치 패키지(DMG)는 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist 라는 실행 파일을 다음과 유사한 plist 정의를 포함하여 설치합니다.

<?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.myslq.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>
Note

일부 사용자는 plist DOCTYPE 선언을 추가하면 린트(lint) 체크를 통과하더라도 구동 실행을 실패하게 한다고 보고합니다. 복사-붙여넣기 에러인 것 같습니다. 위의 정보를 포함하는 파일의 md5 체크섬은 d925f05f6d1b6ee5ce5451b596d6baed입니다.

실행된 서비스를 활성화하려면 다음 중 하나를 수행하십시오.

  • macOS 시스템 환경설정을 열고 MySQL 환경설정 패널을 선택한 후 Start MySQL Server를 실행하십시오.

그림 2.18 MySQL 기본 설정 창: 위치

인스턴스 페이지는 MySQL 시작 또는 중지 옵션이 있으며, 데이터베이스 초기화(Initialize Database)는 data/ 디렉토리를 다시 만듭니다. 언인스톨(Uninstall)은 MySQL 서버 및 선택적으로 MySQL 환경설정 패널과 실행된 정보를 제거합니다.

그림 2.19 MySQL 환경 설정 창: 인스턴스

  • 또는, 실행된 파일을 수동으로 로드하십시오.
shell> cd /Library/LaunchDaemons
shell> sudo launchctl load -F com.oracle.oss.mysql.mysqld.plist
  • 부팅시 MySQL을 자동으로 시작하도록 구성하려면 다음을 수행하십시오.
shell> sudo launchctl load -w com.oracle.oss.mysql.mysqld.plist
Note

MySQL 서버를 업그레이드 할 때, 실행된 설치 프로세스는 MySQL 서버 5.7.7 이하와 함께 설치된 이전 시작 항목을 제거합니다.
또한, 업그레이드는 com.oracle.oss.mysql.msyqld.plist라는 기존 실행 파일을 교체합니다.

추가 실행 관련 정보:

  • plist 항목은 커맨드 라인 인수로 전달되므로 my.cnf 항목을 대체합니다. 프로그램 옵션 전달에 대한 자세한 정보는 4.2.2절, "프로그램 옵션 지정"을 참조하세요.
  • programArguments 섹션은 프로그램에 전달되는 커맨드 라인 옵션(이 경우 mysqld 바이너리)을 정의합니다.
  • 기본 plist 정의는 덜 복잡한 사용 사례를 염두에 두고 작성되었습니다. 보다 복잡한 설정의 경우, 일부 인수를 제거하고 대신 my.cof와 같은 MySQL 구성 파일을 사용해야 합니다.
  • plist 파일을 편집하는 경우, MySQL을 재설치하거나 업그래이드 할 때 관리자 옵션(installer option)을 선택 취소하세요. 그렇지 않으면, 편집한 plist 파일은 덮어 써지고, 모든 편집 내용이 손실됩니다.

기본 plist 정의는 여러 ProgramArguments를 정의하므로, 대부분의 이 인수를 제거하고 대신 my.conf MySQL 구성 파일을 사용하여 정의할 수 있습니다. 예를 들면 다음과 같습니다.

<?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>

이 경우,  basedir, datadir, plugin_dir, log_error, pid_file, keyring_file_data, 및 --early-plugin-load 옵션이 기본 plist ProgramArguments 정의에서 제거되었으며, 대신 my.cof에 정의되었을 수 있습니다.

블로그 이미지

uchacha

개발자 일지

,