Enables mysql to be automatically started when Mac is started, and mysql to be started when Mac is started

Source: Internet
Author: User

Enables mysql to be automatically started when Mac is started, and mysql to be started when Mac is started

Before mysql was installed, the installer automatically added system services and started mysql when the system was started.

However, after upgrading Mac OSX to 10.10.1 Yosemite today, we found that mysql was not started when the system was started.

Try mac launchctl to implement this function.

The method is also simple.


1. edit a mysql Startup File.

Enter:

sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist


2. Enter the Startup File Content:

<?xml version="1.0" encoding="UTF-8"?>  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  <plist version="1.0">    <dict>      <key>KeepAlive</key>      <true/>      <key>Label</key>      <string>com.mysql.mysqld</string>      <key>ProgramArguments</key>      <array>      <string>/usr/local/mysql/bin/mysqld_safe</string>      <string>--user=root</string>      </array>      </dict>  </plist> 

The/usr/local/mysql/in the xml above is the directory where my mysql is located.


3. Load the Startup File

Enter:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist


In this way, you will find that mysql is successfully started.


I have to say that the new Mac version is quite nice.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.