Mysql 5.5.10 - Mac 10.6.x - auto start

后端 未结 2 2044
小蘑菇
小蘑菇 2021-01-06 21:38

I\'m trying to automatically start mysql 5.5.10 community server (gpl) on my mac pro. I\'ve read several threads on this forum. I\'m still baffled, because those threads r

2条回答
  •  逝去的感伤
    2021-01-06 22:13

    You actuall have to create this file... Best way is with a symlink:

    mkdir /Library/StartupItems/MySQLCOM
    cd /Library/StartupItems/MySQLCOM/
    ln -s /path/to/installation/mysql/support-files/mysql.server MySQLCOM
    

    However I wouldnt recommend this. You should do it proper and use launchd instead - this is the proper OS X way :-)

    First create a plist at /Library/LaunchDaemons/com.mysql.mysqld.plist

    
    
    
    
        Disabled
        
        GroupName
        _mysql
        KeepAlive
        
        Label
        com.mysql.mysqld
        Program
        /usr/local/mysql/bin/mysqld
        ProgramArguments
        
            --user=_mysql
        
        RunAtLoad
        
        Umask
        7
        UserName
        _mysql
        WorkingDirectory
        INSTALL_PATH/mysql
    
    
    

    Then an adjust the permission:

    sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist
    sudo chgrp wheel /Library/LaunchDaemons/com.mysql.mysqld.plist
    sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysqld.plist
    

    Now MySQL should be launched on startup. To test that everything works without rebooting you can run: sudo launchctl load com.mysql.mysqld.plist then check your error logs for messages.

    IF you need to add special args (like custom logs, cnf, etc..) you can do so by specifying them as elements in the element following ProgramArguments. The values of those element should be the standard switches you would use with mysqld.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题