忘记Mysql密码的解决办法小结
方法1:用SETPASSWORD命令
mysql-uroot
mysql>SETPASSWORDFOR'root'@'localhost'=PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin-urootpassword"newpass"
如果root已经设置过密码,采用如下方法
mysqladmin-urootpasswordoldpass"newpass"
方法3:用UPDATE直接编辑user表
mysql-uroot
mysql>usemysql;
mysql>UPDATEuserSETPassword=PASSWORD('newpass')WHEREuser='root';
mysql>FLUSHPRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe--skip-grant-tables&
mysql-urootmysql
mysql>UPDATEuserSETpassword=PASSWORD("newpassword")WHEREuser='root';
mysql>FLUSHPRIVILEGES;
希望对大家有所帮助。
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语