1.首先不输入密码进入mysql,即输入: mysql -hlocalhost -uroot
mysql -hlocalhost -uroot
2.设置密码且永久 alter user 'root'@'localhost'identified by '123456' password expire never;
alter user 'root'@'localhost'identified by '123456' password expire never;