安裝完mysql 以後,登錄之後,無論運行任何命令,老是提示這個html
step 1: SET PASSWORD = PASSWORD('your new password');mysql
step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;sql
step 3: flush privileges;ide
完成以上三步退出再登,使用新設置的密碼就好了,以上除了紅色的本身修改爲新密碼外,其餘原樣輸入便可post
參考1: https://dev.mysql.com/doc/refman/5.6/en/alter-user.htmlthis
參考2: http://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.htmlurl
參考3: http://stackoverflow.com/questions/33467337/reset-mysql-root-password-using-alter-user-statement-after-install-on-macspa