centos7下mariadb 忘记密码处理方法

Linux就该这么学

systemctl stop mariadb ==>停止mariadb数据库

mysqld_safe --skip-grant-table ==>进入单机模式

use mysql;==>进入mysql库

update user set password=password(新密码) where user='root' and host='localhost';==>设置新密码

flush privileges;==>刷新

新开窗口 mysqladmin -uroot -p shutdown ==>新密码测试关掉数据库,成功关闭就证明修改成功

systemctl start mariadb ==>重启服务

本文由 CentOS中文站 - 专注Linux技术 作者:centos 发表,其版权均为 CentOS中文站 - 专注Linux技术 所有,文章内容系作者个人观点,不代表 CentOS中文站 - 专注Linux技术 对观点赞同或支持。如需转载,请注明文章来源。

相关文章

发表评论

邮箱地址不会被公开。 必填项已用*标注