MySQL忘记密码解决
1.设置管理员root密码为123
开启MySQL服务后
PS C:\WINDOWS\system32> mysqladmin -uroot -p password "123"
Enter password:
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
#直接回车,忽略上述提示
再次登录不输入密码,出现一下结果。
PS C:\WINDOWS\system32> mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
2.更改密码
PS C:\WINDOWS\system32>mysqladmin -uroot -p"123" password "456" #修改mysql密码,因为已经有密码了,所以必须输入原密码才能设置新密码
3.忘记密码
3.1关闭MySQL服务器
PS C:\WINDOWS\system32> net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
3.2跳过授权表
PS C:\WINDOWS\system32> mysqld --skip-grant-tables
3.3再次登录时无需输入密码
PS C:\WINDOWS\system32> mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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.
3.4更改密码为'abc'
mysql> update mysql.user set authentication_string =password('abc') where User='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
3.5刷新权限后退出
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
3.6关闭mysql进程
PS C:\WINDOWS\system32> tasklist |findstr mysql
mysqld.exe 11452 Services 0 173,284 K
PS C:\WINDOWS\system32> taskkill /F /PID 11452
成功: 已终止 PID 为 11452 的进程。
3.7再次开启服务,使用新密码登录
PS C:\WINDOWS\system32> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
PS C:\WINDOWS\system32> mysql -uroot -p
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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>
MySQL忘记密码解决的更多相关文章
- 十五、mac 中登陆mysql忘记密码解决办法
mac 中登陆mysql忘记密码解决办法 1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter pa ...
- mysql忘记密码解决的办法
[很管用]忘记mysql root密码解决办法 1.编辑MySQL配置文件: 首先停止mysql服务, 然后开始编辑mysql配置文件:vi /etc/my.cnf在[mysqld]配置段添加如下一行 ...
- MySQL忘记密码解决办法
一.windows下mysql忘记root密码的解决方法 详细出处参考:http://www.jb51.net/article/21984.htm 1,停止MYSQL服务,CMD打开DOS窗口,输入 ...
- C#工具:MySQL忘记密码解决方法
1.进入管理员控制台停止mysql服务:net stop mysql; 2.进入mysql的安装路径,如我的安装路径为C:\Program Files\MySQL\MySQL Server 5.5,打 ...
- mac 中登陆mysql忘记密码解决办法
1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter password: ERROR 1045 (2 ...
- mysql忘记密码解决方法
在windows下:打开命令行窗口,停止mysql服务: net stop mysql 启动mysql,执行: mysqld -nt --skip-grant-tables 另外打开一个命令行窗口,执 ...
- MySQL 忘记密码解决办法
第一步: 关闭MySQL服务. 第二步: 打开DOS窗口,在里面输入安装MqSQL的目录本机为:C:\Program Files\MySQL\MySQL Server 5.6\bin 第三步: 在命 ...
- mac中登陆mysql忘记密码解决办法
1.打开终端,输入命令:cd /usr/local/mysql/bin 2.mysql -uroot -p,用这条命令登陆时报错信息: 报错:Enter password: ERROR 1045 (2 ...
- mac mysql忘记密码解决办法
http://www.jb51.net/article/87580.htm http://blog.csdn.net/soft2buy/article/details/50223373
随机推荐
- 链家网爬虫同步VS异步执行时间对比
异步执行时间 import time import asyncio import aiohttp from lxml import etree start_time = time.time() asy ...
- shell wait 和sleep 对比
wait 在 shell 中使用 wait 是在等待上一批或上一个脚本执行完(即上一个的进程终止),再执行wait之后的命令. sleep sleep 1 睡眠1秒 sleep 1s 睡眠1秒 sle ...
- 在取变量名的时候,千万不要用new
这样子是会报错的
- Telegraf+Influxdb+Grafana(Windows下本机简易监控系统搭建)
1.文件名称 telegraf-1.5.0_windows_amd64.zip influxdb-1.4.2_windows_amd64.zip grafana-4.6.3.windows-x64.z ...
- mac使用xposed超详细入门级教程Android Studio-20190930
工具 这里我使用的工具是Android Studio3.4.1,电脑环境mac os mojave 10.14.6(这个应该问题不大) 创建项目 1.打开Android Studio,看到这个界面,并 ...
- python学习之模块:xlsxwriter
1.安装xlsxwriter模块 pip install xlsxwriter 2.使用 import xlsxwriter workbook = xlsxwriter.Workbook('hello ...
- 手写一个MVVM
最近看了珠峰的架构课——实现一个MVVM. 首先,我们来了解一下什么是MVVM. MVVM是Model-View-ViewModel的简写.它本质上就是MVC 的改进版.MVVM 就是将其中的View ...
- javaScript(拼写树形)+ajax请求,去后台查找数据
第一步:页面加载完成时,利用jquery中的一函数,调用js方法,js方法,发送ajax请求,去后台查找父类权限集合,响应回来json格式的数据,对数据进行操作,往页面上添加内容 //页面初始化加载菜 ...
- c语言面试宝典(经典,超详细)
c语言面试宝典(经典,超详细) 2018年08月25日 09:32:19 chengxuyuan997 阅读数:7799 摘自:https://blog.csdn.net/chengxuyuan9 ...
- Qt编写控件属性设计器6-动态属性
一.前言 之前就提过,Qt的属性机制强大到爆,这次的动态属性功能就是要让他爆,很难想象只要一行代码即可widget->setProperty("value", value); ...