mysql -u root -p
use mysql
設置密碼永遠不會過期,記住這個時候還是隻能本地連接,並不能外部連接,
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
設置所有地址都可以訪問mysql
update user set host='%' where user ='root';
update user set plugin='mysql_native_password' where user ='root';
授於所有權限
grant all on *.* to 'root'@'%';
flush privileges;
重啓mysql