mysql修改数据库密码


方法1:

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

use mysql;

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

方法2:

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

set password=password('newpassword');

方法3:

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服务,密码才能生效。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM