修改mysql数据库的账号或者密码

以管理员身份进入命令行模式


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';




不要忘记后面的分号(;)

不要忘记后面的分号(;)

猜你喜欢

转载自blog.csdn.net/niudasheng/article/details/78706908
今日推荐