kn007的个人博客
♥ You are here: Home > > > vps修改mysql密码相关

vps修改mysql密码相关

by | No Comment

在ssh中输入下面命令,登录到mysql

mysql -u root -p

然后,在mysql>下面分别键入

use mysql;
update user set password=PASSWORD("NEWPASSWORD") where User='root';
flush privileges;
quit

其中的NEWPASSWORD就是新的密码,root是用户,你改你自己要的。
如果忘记密码,咋办呢,别急,在ssh输入

/mysql的安装目录/bin/mysqld_safe --skip-grant-tables

来跳过密码链。
接着

/mysql的安装目录/bin/mysql --user=root mysql

最后在执行:

update user set password=PASSWORD("NEWPASSWORD") where User='root';
flush privileges;
quit

转载请注明转自:kn007的个人博客的《vps修改mysql密码相关

donate
有所帮助?
Tags: , ,

Comments

No Comment立即评论
Loading...

icon_wink.gificon_neutral.gificon_mad.gificon_twisted.gificon_smile.gificon_eek.gificon_sad.gificon_rolleyes.gificon_razz.gificon_redface.gificon_surprised.gificon_mrgreen.gificon_lol.gificon_idea.gificon_biggrin.gificon_evil.gificon_cry.gificon_cool.gificon_arrow.gificon_confused.gificon_question.gificon_exclaim.gif