linux下mysql忘记root密码怎么办
Linux下MySQL忘记root密码怎么办?
Linux下MySQL忘记root密码怎么办?
1. 修改MySQL配置文件
默认MySQL的配置文件为/etc/my.cnf,在[mysqld]下面添加一行
1.skip-grant-tables
2. 保存配置文件,重启MySQL服务
1.service mysqld restart
3. 再次进入MySQL
1.[KANO@kelvin mysql]$ mysql -u root -p
2.Enter password: #此处直接回车
3.Welcome to the MySQL monitor. Commands end with ; or \g.
4.Your MySQL connection id is 2
5.Server version: 5.7.11 MySQL Community Server (GPL)
6.
7.Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
8.
9.Oracle is a registered trademark of Oracle Corporation and/or its
10.affiliates. Other names may be trademarks of their respective
11.owners.
12.
13.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
14.
15.mysql>
16.
这样我们就能照常进入MySQL
4. 重新修改root密码
1.mysql> use mysql
2.Reading table information for completion of table and column names
3.You can turn off this feature to get a quicker startup with -A
4.
5.Database changed
6.mysql> UPDATE user SET password = password('123456') WHERE user = 'root';
7.ERROR 1054 (42S22): Unknown column 'password' in 'field list'
8.
这个时候出现了问题,没有找到password这个字段
原来是mysql数据库下已经没有password这个字段,改成了
1.authentication_string
因此我们要更换语句
1.mysql> update mysql.user set authentication_string=password('123456') where user='root';
2.Query OK, 1 row affected, 1 warning (0.03 sec)
3.Rows matched: 1 Changed: 1 Warnings: 1
4.
5.mysql> exit;
6.Bye
5. 编辑配置文件,把添加的那行删去,再重启MySQL
1.[KANO@kelvin mysql]$ sudo vim /etc/my.cnf
2.[KANO@kelvin mysql]$ service mysqld restart
3.Redirecting to /bin/systemctl restart mysqld.service
4.
然后输入密码就可以登录MySQL了~:-D
linux下mysql忘记root密码怎么办的更多相关文章
- Linux下mysql忘记root密码
一台机器上的MYSQL服务器很久没用了,忘了root密码无法连接.一时情急,网上搜寻办法,解决,记录在此备用. 修改MySQL的登录设置: //不同的版本的Linux配置文件的位置也不一样,以Lin ...
- Linux 下mysql忘记root密码解决方法
忘记root密码怎么办:1.关闭数据库2.使用-->mysqld_safe --skip-grant-tables &--<启动数据库3.使用空密码进入数据库(mysql命令后直接 ...
- linux下mysql忘记root密码的解决方案
1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库. 因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 状态下,其他的用户也可以任意地登录 ...
- linux下mysql忘记root密码解决方法
如果使用 MySQL 数据库忘记了root账号密码,可以通过调节配置文件,跳过密码的方式登数据库, 在数据库里面修改账号密码,一般默认的账号是 root 1.编辑 MySQL 配置文件 my.cnf ...
- skip-grant-tables 修改linux的mysql忘记root密码
skip-grant-tables 修改linux的mysql忘记root密码 今天修改mysql中的admin用户权限,在执行update user set host =' %' where use ...
- MySQL 5.7 Command Line Client输入密码后闪退和windows下mysql忘记root密码的解决办法
MySQL 5.7 Command Line Client输入密码后闪退的问题: 问题分析: 1.查看mysql command line client默认执行的一些参数.方法:开始->所有程序 ...
- Ubuntu下MySQL忘记root密码重置
MySQL忘记root密码肿么办?-_-||| 这种情况虽然不是很常见,但是有时长时间没有登录系统,还真会忘记密码.这时候,如果您能以系统管理员权限登陆密码,那还是有救的.放大招,将其重置即可. ...
- windows下mysql忘记root密码的解决办法
今天早上 一朋友说自己的mysql 忘记root密码了 让我帮忙给看看,因为没有接触过mysql 所以从网上找了一下信息经我亲身实践 已经成功!mysql版本是5.1以下是从网上找的信息: 1. 首 ...
- linux下mysql的root密码忘记解决方法
1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库. 因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 状态下,其他的用户也可以任意地登录 ...
随机推荐
- tomcat https jks 沃通免费证书安装 解决方案
网上百度了一天什么没百度到,最后谷歌到了一篇文章启发之下解决之. 代理谷歌网站推荐一个,可以直接上谷歌: https://www.yundou.info ----------------------- ...
- BestCoder 2nd Anniversary 1002 Arrange
排除所有不符合条件后根据当前位置上下界计算, 由于前面取的数肯定在之后的区间内,所以去掉已取的个数即可. #include <iostream> #include <cstdio&g ...
- [Linked List]Reorder List
otal Accepted: 54991 Total Submissions: 252600 Difficulty: Medium Given a singly linked list L: L0→L ...
- 从汇编看c++成员函数指针(二)
下面先看一段c++源码: #include <cstdio> using namespace std; class X { public: virtual int get1() { ; } ...
- mysql 时间戳按指定格式(Y-m-d)取出
之前做采集脚本,把采集的时间按unix时间戳的形式取出 那么在写sql语句的时候,需要按时间查询相应的记录,页面传进来的$time 是'2014-01'之类的字符串,那么怎么写sql呢 $sql ...
- ios html5 长按复制文本
以前做的项目,主要是针对ios的,安卓上面也没有测试. 原理其实是系统自带的功能,那时候借鉴的其他网站,没有试验通过document.execCommand("Copy"),别的j ...
- TensorFlow 深度学习笔记 TensorFlow实现与优化深度神经网络
转载请注明作者:梦里风林 Github工程地址:https://github.com/ahangchen/GDLnotes 欢迎star,有问题可以到Issue区讨论 官方教程地址 视频/字幕下载 全 ...
- Visual Studio 2015 Update 3 RC 候选预览版粗来了
.Net 基金会 http://www.dotnetfoundation.org/ 更新的真快,刚打完2的补丁包,3就粗来了............ https://www.visualstudio. ...
- JavaScript学习总结(十六)——Javascript闭包(Closure)
原文地址: http://www.cnblogs.com/xdp-gacl/p/3703876.html 闭包(closure)是Javascript语言的一个难点,也是它的特色, 很多高级应用都要依 ...
- ios中block中的探究
http://blog.csdn.net/jasonblog/article/details/7756763