注:若是以前安裝過mysql,須要執行如下步驟,將以前的mysql所有卸載html
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/mysql
參考連接:https://www.jianshu.com/p/fba...mysql
vim ~/.bash_profile
,進入編輯模式,將PATH="$PATH":/usr/local/mysql/bin
拷貝到裏面。保存退出source ~/.bash_profile
echo $PATH
vim ~/.zshrc
輸入export PATH=${PATH}:/usr/local/mysql/bin
保存退出source ~/.zshrc
mysql -u root -p
, 密碼爲默認密碼set PASSWORD =PASSWORD('123456');
// 例如密碼爲123456sudo /usr/local/MySQL/support-files/mysql.server start
sql
sudo /usr/local/mysql/support-files/mysql.server stop
數據庫
sudo /usr/local/mysql/support-files/mysql.server restart
vim