一、首先須要下載mac版mysql,dmg文件安裝,默認路徑爲/usr/local/下mysql
二、設置訪問環境變量,vim ~/.bash_profile,PATH=$PATH:/usr/local/mysql/,source ~/.bash_profilesql
三、sudo到root帳戶下,執行命令mysqld_safe --skip-grant-tables --skip-networking &vim
四、啓動mysql服務,mysql -uroot -p便可免密登陸bash
五、執行以下腳本修改root密碼ip
update user set authentication_string=password('root') where user='root' and Host='localhost';string
FLUSH PRIVILEGES;io
六、啓動mysql服務,mysql -uroot -p便可免密登table