使用mysql-5.6.26-osx10.9-x86_64.dmg安裝之後會在「系統偏好設置」中添加一個「MySql」控制面板mysql
可是啓動MySql Server的端口有可能爲3307不是缺省的3306,若是想使用3306須要修改配置文件 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plistsql
<string>--port=3307</string>
改成shell
<string>--port=3306</string>
shell> mysql -u root mysql mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd') WHERE User = 'root'; mysql> FLUSH PRIVILEGES;
須要配置TCP/IP鏈接管道bash
sudo mkdir /var/mysql sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
爲方便執行mysql命令行,還須要配置環境變量,修改bash_profileoracle
nano ~/.bash_profile
export PATH="/usr/local/mysql/bin:$PATH"
source ~/.bash_profile