1.安裝msyql
brew install mysql
2.啓動mysql
brew services start mysql
3.登錄mysql
默認root密碼爲空。新版mysql數據庫user表沒有password字段,取而代之的是authentication_string字段
mysql -uroot
回車,即可登錄
4.修改密碼
mysql>update mysql.user set authentication_string=password('root') where user='root';
mysql> flush privileges;
一定要刷新,不然新密碼不能生效