Created
September 5, 2013 11:11
-
-
Save BiosSun/6448809 to your computer and use it in GitHub Desktop.
该方法适合在忘记 root 密码时使用,需要有服务器的 root 权限。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 停止当前mysql服务 | |
/etc/init.d/mysqld stop | |
# ---- | |
# 启动mysql | |
/etc/init.d/mysqld start | |
# 使用空密码登录mysql | |
mysql -u root | |
# 进入后修改密码 | |
update mysql.user set password=PASSWORD('your new password') where user='root' | |
flush privileges; | |
quit; | |
# 之后即可使用新密码登录 root 账户 | |
mysql -u root -p | |
#-> input your new password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment