当前位置:Gxlcms > 数据库问题 > centos7下mariadb 首次修改密码及忘记密码处理方法

centos7下mariadb 首次修改密码及忘记密码处理方法

时间:2021-07-01 10:21:17 帮助过:50人阅读



技术分享


忘掉密码

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

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

mysql

use mysql;==>进入mysql库

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

flush privileges;==>刷新

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

systemctl restart mariadb ==>重启服务

skip_name_resolve = ON

第二种方法

 vim /etc/my.cnf

[mysqld]

skip-grant-tables              添加这一行,然后保存,重启服务,,mysql可以直接进去修改了。同上。


本文出自 “何全” 博客,请务必保留此出处http://hequan.blog.51cto.com/5701886/1768386

centos7下mariadb 首次修改密码及忘记密码处理方法

标签:修改密码   password   忘记密码   数据库   local   

人气教程排行