1、用root 进入mysql后
mysql>set password =password('你的密码'); mysql>flush privileges;
www#gaodaima.com来源gao@daima#com搞(%代@#码@网搞代码
2、使用GRANT语句
mysql><a href="https://www.gaodaima.com/tag/grant" title="查看更多关于grant的文章" target="_blank">grant</a> all on *.* to 'root'@'localhost' IDENTIFIED BY '你的密码'with grant option ; mysql>flush privileges;
3、进入mysql库修改user表
mysql>use mysql; mysql>update user set password=password('你的密码') where user='root'; mysql>flush privileges;
推荐:MySQL教程
来源:搞代码网:原文地址:https://www.gaodaima.com