mysql8.0中怎么修改数据库root密码

这期内容当中小编将会给大家带来有关mysql8.0中怎么修改数据库root密码,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

第一步:输入 mysql -u root -p  然后回车

输入密码

第二步:输入 use mysql;

第三步:输入update user set authentication_string='' where user='root';将authentication_string置空

第四步:输入select user,host from user;

mysql8.0中怎么修改数据库root密码

第五步:输入alter user 'root'@'%' identified by '新密码';(注意:我的root host是%,如果user的host是localhost,就需要改成alter user 'root'@'localhost' identified by '新密码';)

上述就是小编为大家分享的mysql8.0中怎么修改数据库root密码了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。