美文网首页
MySQL Install and running

MySQL Install and running

作者: Zihowe | 来源:发表于2017-07-25 11:30 被阅读19次

1 使用.dmg文件安装

2 运行MySQL

  • 左上角点击苹果图标,system preference搜索mysql,就在最下方。
  • 打开之后点start就可以了
  • 详情件reference最后一个链接

3 下载GUI tool for MySQl

Note:

  • /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist文件可以修改port
  • 注意--port=3306,这个是默认的
  • 查看 MySQL server process, 使用命令sudo launchctl list|grep mysql.
Howes-MacBook-Pro:LaunchDaemons howezhao$ sudo launchctl list|grep mysql
13606   0   com.oracle.oss.mysql.mysqld

Trouble shooting

1 在命令行输入mysql,现实command not found, 可能是mysql的path没设置好

  • 在命令行运行export PATH=${PATH}:/usr/local/mysql/bin 再试试
  • .bash_profile 就在打开terminal时的根目录下,使用nano .bash_profile 就可以打开, 在这个文件下添加以上命令行就可以每次打开terminal时自动运行export了。
com.oracle.oss.mysql.mysqld.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.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>
            <string>--port=3306</string>
        </array>
    <key>WorkingDirectory</key>  <string>/usr/local/mysql</string>
</dict>
</plist>

Reference:

https://dev.mysql.com/downloads/
https://dev.mysql.com/downloads/mysql/
https://dev.mysql.com/doc/refman/5.7/en/osx-installation.html
https://dev.mysql.com/doc/refman/5.5/en/osx-installation-pkg.html
https://dev.mysql.com/doc/refman/5.7/en/osx-installation-launchd.html

相关文章

网友评论

      本文标题:MySQL Install and running

      本文链接:https://www.haomeiwen.com/subject/kjdwkxtx.html