mysql忘记root登录密码
没有过忘记密码的程序员是不完美的,对于Oracle忘记密码可以设置orapwdfile文件,
Mysql其中一种方法是通过修改文件免密然后再进行密码的修改:
1.忘记密码
[root@leader ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@leader ~]#
2.修改文件/etc/my.cnf
修改文件前先停掉mysqld服务
[root@leader ~]# service mysqld stop
Stopping mysqld: [ OK ]
[root@leader ~]#vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
skip-grant-table ##添加该参数跳过密码验证
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
3,重启服务进行密码修改
[root@leader ~]# service mysqld start
Starting mysqld: [ OK ]
[root@leader ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password('mysql123')where user='root' and host='localhost';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql>
mysql忘记root登录密码的更多相关文章
- Linux忘记root登录密码解决方法
有时候由于长时间米有登录linux系统,等需要用的时候突然忘记root密码,怎么办?下面简单介绍解决方法. redhat 和 centos 6.5 可以,7.0以上未测 在系统重启后,不停地按”e”键 ...
- mysql忘记root用户密码找回步骤
修改或找回root密码步骤1.修改MySQL的登录设置: # vi /etc/my.cnf 在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi. 2.重新启动mys ...
- Linux 忘记root登录密码解决方法
很多朋友经常会忘记Linux系统的root密码,linux系统忘记root密码的情况该怎么办呢?重新安装系统吗?当然不用!进入单用户模式更改一下root密码即可. 步骤如下: 重启linux系统 3 ...
- mysql 修改root登录密码
mysql -u root -p 然后回车,进入(等于用空密码进入) 2 use mysql; update user set password=password('123456') where us ...
- MySQL忘记root用户密码修改方法
一般来说在MySQL修改用户密码有好几种方法: 1.修改自己的密码可用: set password=password('123456'); 2.修改其它用户的密码可用: set password fo ...
- mysql忘记root用户密码重置密码的方式
解决方法如下: 让mysql不载入权限表,命令:mysqld --skip-grant-tables(windows).mysqld_safe --skip-grant-tables user=mys ...
- skip-grant-tables 修改linux的mysql忘记root密码
skip-grant-tables 修改linux的mysql忘记root密码 今天修改mysql中的admin用户权限,在执行update user set host =' %' where use ...
- mysql 忘记root密码,重置密码,及重置密码后权限问题不能登录的解决方案
由于一段时间没有使用MySQL,忘记了root登录密码. 决定重置下密码,搜索帮助. 参考文档: http://blog.csdn.net/odailidong/article/details/507 ...
- MySQL 5.7 Command Line Client输入密码后闪退和windows下mysql忘记root密码的解决办法
MySQL 5.7 Command Line Client输入密码后闪退的问题: 问题分析: 1.查看mysql command line client默认执行的一些参数.方法:开始->所有程序 ...
随机推荐
- Linux-usermod:增加已建立用户的用户组
usermod --help -g, --gid GROUP force use GROUP as new primary group -G, --groups GROUPS new list of ...
- Magic Potion(网络流)
原题链接 2018南京的铜牌题,听说学长他们上来就A了,我这个图论选手也就上手做了做,结果一言难尽...... 发此篇博客希望自己能牢记自己的菜... 本题大意:有n个heros和m个monsters ...
- 洛谷 P2801 教主的魔法 题解
题面 刚看到这道题的时候用了个树状数组优化前缀和差分的常数优化竟然AC了?(这数据也太水了吧~) 本人做的第一道分块题,调试了好久好久,最后竟然没想到二分上还会出错!(一定要注意)仅此纪念: #inc ...
- CSP-S 2019游记
Day 0 下午到了广州,酒店还不错,不好的是附近没有什么吃饭的地方 zyd和ljz巨神说如果上了450就女装. 晚上看了一下写过模板,本来准备敲几个新模板的的结果被卡常,心态没了.于是又把wys的卡 ...
- APT高持续渗透攻击-后门篇
APT是指高级持续性威胁, 利用先进的攻击手段对特定目标进行长期持续性网络攻击的攻击形式,APT攻击的原理相对于其他攻击形式更为高级和先进,其高级性主要体现在APT在发动攻击之前需要对攻击对象的业务流 ...
- 剑指offer-数值的整数次方-调整数组顺序使奇数位于偶数前面-代码的完整性-python
题目描述 给定一个double类型的浮点数base和int类型的整数exponent.求base的exponent次方. 保证base和exponent不同时为0 思路 求base的expon ...
- sql server 三角函数
正弦函数SIN(x)和反正弦函数ASIN(x) --SIN(x)返回x的正弦,其中x为弧度值 --ASIN(x)返回x的反正弦,即正弦x的值,若x不在-1到1的范围内,则返回NULL 示例:selec ...
- Windows 下apache https配置(phpstudy)
1.首先获取证书,https://www.pianyissl.com/ 免费三个月的 或者 自己生成私钥.证书,然后应用到apache中. http://blog.sina.com.cn/s/blo ...
- killall - 以名字方式来杀死进程
SYNOPSIS (总览) killall [-egiqvw] [-signal] name ... killall -l killall -V DESCRIPTION (描述) killall 发送 ...
- 安卓-去除ActionBar的方法
今天做一个播放器项目,由于要去除ActionBar,纠结好久,原来这么简单 记录一下 只需要修改AndroidManifest.xml文件中的主题即可 <application android: ...