maria 忘记密码

Posted jimmy104

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maria 忘记密码相关的知识,希望对你有一定的参考价值。

 

1、找到mariadb配置文件
命令:find / -name my.cnf

备注:一般是在 /etc/my.cnf

2、修改配置文件
在MariaDB配置文件/etc/my.cnf的[mysqld]配置中加入一行:skip-grant-tables

#=======================================================
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables #注意:插入的就是这行


# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
skip-grant-tables

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

#=======================================================

3、通过SQL修改root密码
[[email protected] ~]$ mysql


MariaDB [mysql]> UPDATE user SET Password = password ( ‘123456 ) WHERE User = ‘root‘ ;
Query OK, 4 rows affected (0.03 sec)
Rows matched: 4 Changed: 4 Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> exit

4、完成,取消免密登录,重启mariadb

5、附上mariadb相关命令

查询状态:systemctl status mariadb
关闭:systemctl status mariadb
开启:systemctl stop mariadb
重启:systemctl restart mariadb





























以上是关于maria 忘记密码的主要内容,如果未能解决你的问题,请参考以下文章

ipad忘记icloud密码如何注销(ipad忘记密码怎么注销icloud账户)

VMware CentOS7 忘记密码解决方法

密码忘记了怎么找回?

MySQl忘记密码怎么办

excel表格忘记密码怎么解除保护(excel表格忘记密码怎么打开)

救命啊,vSphere Client 忘记密码怎么办