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. iOS Programming Web Services and UIWebView

    iOS Programming Web Services and UIWebView The work is divided into two parts. The first is connecti ...

  2. RequireJS 上手使用

    首先 点击此处 得到requirejs. 捣鼓了俩小时终于运行成功了,原因是因为require(['我是空格underscore',...],function(){...})的时候 变量多个空格(坑爹 ...

  3. PHP正则表达式考察点

    正则表达式的作用 分隔.查找.匹配.替换字符串 正则表达式的组成部分 分隔符 "/" . "#" . "~" 通用原子 \d : 十进制的0 ...

  4. Dynamic type checking and runtime type information

    动态类型的关键是将动态对象与实际类型信息绑定. See also: Dynamic programming language and Interpreted language Dynamic type ...

  5. 自动化测试selenium + request + 动态加载页面

    # demo01from selenium import webdriver from time import sleep bro = webdriver.Chrome(executable_path ...

  6. charset - 设置 G0/G1 字符集槽中的一个的 ACM

    总览 (SYNOPSIS) charset [-v] G0|G1 [cp437|iso01|vt100|user|<acm_name>] 描述 (DESCRIPTION) linux 终端 ...

  7. must have same number of columns as the referenced primary key

    在使用Hibernate实现多对多的测试过程中遇到了这个问题 解决的方法: 将黄色字段的内容添加进去 <set name="customerSet" table=" ...

  8. 获取本地验证码cookie

    window.document.onkeydown = function (evt) { evt = (evt) ? evt : window.event; if (evt.keyCode) { if ...

  9. ios中摄像头/相册获取图片压缩图片上传服务器方法总结

    本文章介绍了关于ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结,有需要了解的同学可以参考一下下.     这几天在搞iphone上面一个应用的开发,里面有需要摄像头/相册编程和图片上传的问 ...

  10. js 实现弹力球效果

    1.html代码: <div id='imgid'> <img src="img/5.png"> </div> 2.js代码: imgobj=d ...