1. 登入mysql mysql -h '127.0.0.1' -p root -u root 2. 修改密码 mysql> use mysql; mysql> update user set password=PASSWORD("mynewpassword") where User='root'; mysql> flush privileges;