以管理员身份进入命令行模式
mysql -u root -p Enter password:*** mysql>use mysql; Database changed mysql> UPDATE user SET password=PASSWORD("新密码") WHERE user="root"; //更改密码 (//或者输入 mysql> UPDATE user SET user="新用户名" WHERE user="root"; //更改用户名 ) mysql> FLUSH PRIVILEGES; mysql> quit;
mysql在5.7后修改密码有了些改变
update mysql.user set authentication_string=password('新密码')where user='root'and host='localhost';
不要忘记后面的分号(;)
不要忘记后面的分号(;)