Linux MariaDB 遗忘密码后重置密码

MariaDB 是 MySQL 的一个分支数据库。处理的办法和 MySQL 相同。

修改 MySQL 配置文件

在 [mysqld] 追加配置项:

[root@node9 ~]# vim /etc/my.cnf
[root@node9 ~]# cat /etc/my.cnf
...
[mysqld]
skip-grant-tables
...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

重启相关服务

该示例使用的是 MariaDB,重启该服务并查看是否启动成功:

[root@node9 ~]# systemctl restart mariadb
[root@node9 ~]# systemctl status mariadb
  • 1
  • 2
  • 1
  • 2

登陆数据库修改密码

[root@node9 ~]# mysql -uroot -p
MariaDB [mysql]> UPDATE user SET Password = password('48eb1c1c770d4bbc') WHERE User = 'root' ;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

这边需要注意 password 必须需要写进来,否则修改不完全,报错信息如下:

[root@node9 ~]# mysql -uroot -p
MariaDB [mysql]> UPDATE user SET Password = '48eb1c1c770d4bbc' WHERE User = 'root' ;
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
...
[root@node9 ~]# mysql -uroot -p
Enter password:
ERROR 1275 (HY000): Server is running in --secure-auth mode, but 'root'@'localhost' has a password in the old format; please change the password to the new format
...

Linux MariaDB 遗忘密码后重置密码的更多相关文章

  1. linux下mysql 8.0忘记密码后重置密码

    1://免密码登陆 找到mysql配置文件:my.cnf, 在[mysqld]模块添加:skip-grant-tables   保存退出: 2://使配置生效 重启mysql服务:  service ...

  2. CentOS7下mongodb忘记密码后重置密码

    新装mongodb后,结果一段时间没有用,密码给忘记了,只能重置密码了. 步骤如下: 1.找到mongodb的配置文件 通过ps -ef|grep mongod找到mongodb的配置文件mongod ...

  3. Ubuntu 忘记密码后重置密码

    摘自百度贴吧:http://tieba.baidu.com/p/2869755075 选后会再出现一个选单,让你选取,请选取:root - Drop to root shell prompt 选完后, ...

  4. MySQL8.0忘记密码后重置密码(亲测有效)

    实测,在mysql8系统下,用mysqld --console --skip-grant-tables --shared-memory可以无密码启动服务 服务启动后,以空密码登入系统 mysql.ex ...

  5. MySQL 8下忘密码后重置密码

    解决方案:1):设置mysql为无密码启动  (修改MySQL的登录设置:vi /etc/my.cnf   在[mysqld]的段中加上一句:skip-grant-table)  2):重新启动mys ...

  6. MySQL忘记密码后重置密码(Mac )

    安装好MySQL以后,系统给了个默认的的密码,然后说如果忘记了默认的密码......我复制了默认密码就走过了这一步,这一步就是我漫长旅程的开始.他给的密码太复杂了,当然我得换一个,而且我还要假装我不记 ...

  7. 忘记mysql密码后重置密码

    https://jingyan.baidu.com/album/c275f6ba479ca9e33d7567ee.html?picindex=4 找不到mysql的my.ini文件问题: https: ...

  8. Mysql 5.7 忘记root密码或重置密码的详细方法

    在Centos中安装完MySQL数据库以后,不知道密码,这可怎么办,下面给大家说一下怎么重置密码 在Centos中安装完MySQL数据库以后,不知道密码,这可怎么办,下面给大家说一下怎么重置密码 1. ...

  9. mysql 忘记root密码,重置密码,及重置密码后权限问题不能登录的解决方案

    由于一段时间没有使用MySQL,忘记了root登录密码. 决定重置下密码,搜索帮助. 参考文档: http://blog.csdn.net/odailidong/article/details/507 ...

随机推荐

  1. Java常用的排序查找算法

    public static void main(String[] args) {      // bubbleSort(); // int[] a = {20,2,10,8,12,17,4,25,11 ...

  2. oracle 时间格式转化以及计算

    --A表中的日期字段 create_date   例如:2017-08-05  转化为2017年8月5日   oracle 在这里的双引号会忽略 select to_char(to_date(tt.c ...

  3. 安卓 Android 简单数据库(增删改查)

    <Button android:id="@+id/delete_btn" android:layout_width="wrap_content" andr ...

  4. java_StringBuffer、StringBuilder

    StringBuffer和StringBuider是可变的字符串,使用方法 相同,StringBuffer是线程安全的,StringBuider是线程不安全的 public class StringT ...

  5. [笔记] APIO 2018 Day1

    计算折纸 computaional origami 全息算法(???) margulis napkin problem 素数里有任意长的等差数列 xor gate Σxi or gate(exact ...

  6. [Python3网络爬虫开发实战] 1.2.3-ChromeDriver的安装

    前面我们成功安装好了Selenium库,但是它是一个自动化测试工具,需要浏览器来配合使用,本节中我们就介绍一下Chrome浏览器及ChromeDriver驱动的配置. 首先,下载Chrome浏览器,方 ...

  7. assert.deepStrictEqual()

    assert.deepStrictEqual(actual, expected[, message]) 一般情况下等同于 assert.deepEqual(),但有两个例外.首先,原始值是使用全等运算 ...

  8. JS 根据参数是否为空进行true|false判断呢

    <form id="actForm" action="${ctx}/meeting/vip/saveMeetingAttendVipAct" method ...

  9. (转载)C++ string中find() ,rfind() 等函数 用法总结及示例

    string中 find()的应用  (rfind() 类似,只是从反向查找) 原型如下: (1)size_t find (const string& str, size_t pos = 0) ...

  10. Vue如何实现swiper左右滑动内容区控制导航tab同时切换高亮

    Vue如何实现左右滑动内容区控制导航tab同时切换高亮,实现的效果是:点击导航按钮时内容区发生改变,左右滑动内容区时导航按钮跟随切换高亮,停留在某个内容区时刷新页面后仍然停留在当前内容区.       ...