mysql密码忘记了怎么办
1. 停止mysql服务
[root@db02data]#/etc/init.d/mysqldstopShuttingdownMySQL..SUCCESS!
2. 使用--skip-grant-tables启动mysql,忽略授权登录验证
[root@db02data]#mysqld_safe--skip-grant-tables--user=mysql>/dev/null2>&1&[1]30246
3. 登录mysql,修root密码
[root@db02data]#mysqlmysql>UPDATEmysql.userSETpassword=PASSWORD("123")WHEREuser='root'andhost='localhost';QueryOK,0rowsaffected(0.00sec)Rowsmatched:1Changed:0Warnings:0mysql>flushprivileges;QueryOK,0rowsaffected(0.01sec)mysql>quitBye
4. 退出mysql,并且重新启动mysql
[root@db02data]#/etc/init.d/mysqldstopShuttingdownMySQL..SUCCESS![1]+Donemysqld_safe--skip-grant-tables--user=mysql>/dev/null2>&1[root@db02data]#/etc/init.d/mysqldstartStartingMySQL.SUCCESS!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。