mysql修改密码

 1. mysql最开始使用是没有密码的,要求输入密码时直接回车就能够,可是本身设置密码后就要输入密码才能登录。下面就写一下在知道旧密码的状况下改密码。mysql

进入mysql系统:set password for root@localhost = password('newpassword');将root的密码设置成newpasswordsql

2.还有一种状况就是忘记原密码ui

    首先要中止mysql服务:service mysqld stop;spa

    跳过受权启动:mysql_safe --skip-grant-tables &rest

    以root用户登陆:mysql -u rootip

    update mysql库的user表:use mysql;→update user set password=password('newpassword') where user = 'root' and host = 'localhost';→flush privileges;→quit
it

     而后重启mysql服务:service mysqld restarttable

相关文章
相关标签/搜索