

MySQL初始化root密码以及root密码忘记解决方法
source link: https://xushanxiang.com/2019/07/mysql-initializes-the-root-password.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

MySQL初始化root密码以及root密码忘记解决方法
一、MySQL初始化root密码
mysql默认root用户没有密码,输入mysql –u root 进入mysql
1、进入mysql数据库
use mysql;
2、初始化root密码
mysql>update user set password=PASSWORD('123456') where User='root';
(补充:授权请戳这里)
二、root密码忘记解决方法(Windows环境)
1、确保MySQL服务停止
例如,在DOS窗口下输入 net stop mysql5 或 net stop mysql
2、打开第一个cmd窗口,进入MySQL安装目录下的bin目录
例如,D:\mysql-5.5.35-win32\bin>
3、跳过权限安全检查,MySQL服务运行起来后,不用输入密码就能进入数据库
例如,D:\mysql-5.5.35-win32\bin>mysqld –defaults-file=”D:\mysql-5.5.35-win32\my.ini” –console –skip-grant-tables
4、打开第二个cmd窗口,连接MySQL
输入命令:mysql -uroot -p
出现 Enter password: 直接回车
5、使用命令切换到mysql数据库:
use mysql;
6、使用命令更改root密码:
UPDATE user SET Password=PASSWORD('在此输入新密码') where USER='root';
7、刷新权限:
FLUSH PRIVILEGES;
8、退出:
quit;
9、关闭上面打开的两个cmd窗口,重新启动MySQL服务。
如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!
发表评论 取消回复
电子邮件地址不会被公开。 必填项已用*标注
Recommend
-
118
这里是admin的密码丢失,id=1,其他用户以此类推。#mysqlMariaDB[(none)]>showdatabases;+--------------------+|Database+--------------------+|cacti|information_schema|mysql|performance_schema|test+--------------------+5rowsi
-
61
-
45
本文主要介绍,mysql5.7版本的数据库,忘记密码的解决方案! 一、问题背景 很久之前,小编在linux(centos7)服务器上安装了mysql5.7的数据库,但是很长时间没有使用过,也不知道里面是否有有用的数据库,密码也忘记...
-
5
Docker Mysql DB 初始化 UTF8 乱码问题的解决 最近在补单元测试,需要 mock 一个 DB,初始化 dump 数据阶段需要 dump 一些带中文的数据,但是发现跑起来都是乱码,非...
-
7
MySQL 忘记密码怎么办 作者: 敖天羽 时间: May 31, 2021 分类:
-
3
WSL2下忘记Linux子系统root密码的解决办法 - Zikin的独立博客 WSL 是适用于 Linux 的 Windows 子系统(Windows Subsystem for Linux,WSL)是一个为在 Windows 10 和 Windows Server 2019 上能够原生运行 Linux 二进制可执行文件的兼容层。 今天需...
-
5
wordpress 忘记密码的一种解决方法 发表于 2021-12-05 分类于 小技巧 阅读次数: 9 Disqus:
-
5
重置忘记的 Windows Server 2016 密码的两种方法 在这篇文章中,我们将展示两种简单的方法来重置忘记的 Windows Server 2016 管理员密码。这些方法也适用于其他 Windows 版本。 作者...
-
3
mysql 忘记root密码 如何找回 2020年11月27日 788点热度...
-
5
忘记 Windows 10 密码解决办法 2022-09-05 Windows R...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK