在mysql系统外,使用mysqladmin
1 mysqladmin -u root -p password "test123" 2 Enter password: 【输入原来的密码】
通过登录mysql系统
1 mysql -uroot -p
2 Enter password: 【输入原来的密码】
3 mysql>use mysql;
4 mysql> update user set password=passworD("test") where user='root';
5 mysql> exit;注意:如果Mysql的版本是5.7及以上的话update语句更换如下:
1 mysql> update user set authentication_string=passworD("test") where user='root';首先拿到操作系统的root权限,然后kill掉Mysql服务或者手动stop掉,这里我推荐使用手动stop;
1 service mysql stop
然后执行
1 mysqld_safe --skip-grant-tables &
&,表示在后台运行,不再后台运行的话,就再打开一个终端吧。
接着登陆MySQL修改密码
1 mysql
2 mysql> use mysql;
3 mysql> UPDATE user SET password=password("test123") WHERE user='root';
4 mysql> exit;注意:如果Mysql的版本是5.7及以上的话update语句如下:
1 mysql> update user set authentication_string=passworD("test") where user='root';以上就是Linux系统怎么修改mysql密码的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号