Linux下修改mysql的root密码方法(亲测有效)
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
1、mysqladmin修改root密码:
1)新数据库,从未设置过root密码,可以使用下面命令:
# mysqladmin -u root password "newpass" #新密码为“newpass”
2)已经设置过root密码,想使用mysqladmin修改,使用下面命令:
[root@localhost ~]# mysqladmin -u root -p root password "redhat" #旧密码为root 新密码为“redhat”
2、使用set password命令:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
3、使用update user直接登录数据库修改密码:
mysql> update user set password = password('newpass') where user = 'root';
mysql> flush privileges;




A beautiful web dashboard for Linux
最近提交(Master分支:5 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
所有评论(0)