修改mysql密码有多种方案下面介绍2个
# /usr/local/mysql/bin/mysqladmin -uroot -p password "New-password" Enter password: 【输入原有密码】 //输入后回车密码就修改成了New-password
# mysql -uroot -p //回车登录mysql系统 Enter password: 【输入原来的密码】 MariaDB [(none)]> use mysql; //进入mysql数据库 MariaDB [(none)]> update user set password=passworD("New-password") where user='root'; MariaDB [(none)]> flush privileges; //刷新数据库 MariaDB [(none)]> exit; //退出
修改完成!
如果你不记得之前的老密码,那么只能尝试破解,破解方案以下:
前置条件:必须拥有服务器最高管理员(root)权限。
# systemctl stop mysql # /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
“&” 表示在后台运行,若不再后台运行,就再打开一个终端。
# mysql MariaDB [(none)]> use mysql; MariaDB [(none)]> UPDATE user SET password=password("New-password") WHERE user='root'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit;
破解完成!
以上就是修改、破解 MariaDB数据库 root 密码的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号