mysql修改数据库密码

方法1:mysql

运行MySQL 5.7 Command Line Client,输入老的密码;sql

use mysql;ide

update user set authentication_string=password('test1234') where user='root';
spa

方法2:string

运行MySQL 5.7 Command Line Client,输入老的密码;io

set password=password('newpassword');test

方法3:date

alter user root@'localhost' identified by 'test1234';密码

假如已经修改mysql下的user表root帐号下的host为%时,须要用下面的语句方法

alter user root@'%' identified by 'test1234';

方法4:进入mysql的bin目录:

    mysqladmin -uroot -poldpassword pasword "newpassword"

修改完密码后,退出mysql,重启mysql服务,密码才能生效。

相关文章
相关标签/搜索