码迷,mamicode.com
首页 > 其他好文 > 详细

maria 忘记密码

时间:2018-10-25 18:03:10      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:通过   pass   str   pre   文件   included   err   ignore   files   

 

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密码
[Richard@localhost ~]$ 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 忘记密码

标签:通过   pass   str   pre   文件   included   err   ignore   files   

原文地址:https://www.cnblogs.com/Jimmy104/p/9851291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!