search
HomeDatabaseMysql TutorialHow to change the password of Mysql database? How to change password in Mysql database



Because I haven’t used the database on my laptop for a long time, and I forgot the password, so I can’t enter the database

I found a method, the modification was successful, record it. [Recommended tutorial: MySQL tutorial]

First find the bin directory under the mysql installation directory and copy the bin directory
How to change the password of Mysql database? How to change password in Mysql database

as an administrator Open the console as my identity, I am win10, and after entering, it looks like this

How to change the password of Mysql database? How to change password in Mysql database

Then this place cannot be directly switched to the bin directory of mysql, which is a little different from win7. An error will be reported, like this

How to change the password of Mysql database? How to change password in Mysql databaseI was also very confused at the time, but later I found that I need to type a cmd here before switching to the bin directory
How to change the password of Mysql database? How to change password in Mysql database Stop the mysql service first, There are two methods
Use the command net stop mysql
How to change the password of Mysql database? How to change password in Mysql database The second method: win R enter services.msc and press Enter, then find mysql, right click to stop
How to change the password of Mysql database? How to change password in Mysql database

Next, go to the bin directory and enter the command mysqld –skip-grant-tables. This is to skip password verification. Next, you need to reopen a command window. The one just now cannot be used (knock on the blackboard, highlight the key points, and take notes in a small notebook). Down, you need to reopen the administrator command window) Enter the bin directory and enter mysql. At this time, you can enter the database
How to change the password of Mysql database? How to change password in Mysql database

Use the command show databases; you can see the database content. The mysql library is where user names are saved. Enter use mysql; Select mysql database

How to change the password of Mysql database? How to change password in Mysql database7. Show tables to view all tables, you will find a user table, which stores account information such as user name, password, permissions, etc.
How to change the password of Mysql database? How to change password in Mysql database

Enter select user,host,password from user; to view account information.
How to change the password of Mysql database? How to change password in Mysql database

Change the root password, enter update user set password=password('root') where user='root' and host='localhost'; change the password to root here. Tip Query ok and the modification is completed
1How to change the password of Mysql database? How to change password in Mysql database10. Check the account information again, select user,host,password from user; You can see that the password has been modified
1How to change the password of Mysql database? How to change password in Mysql database

Exit the command line , restart the mysql database, enter mysql -uroot -p in the bin directory and press Enter. You will be prompted to enter the password. At this time, log in with the new password and you can log in.
1How to change the password of Mysql database? How to change password in Mysql database








The above is the detailed content of How to change the password of Mysql database? How to change password in Mysql database. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Go语言和MySQL数据库:如何进行数据冷热分离处理?Go语言和MySQL数据库:如何进行数据冷热分离处理?Jun 18, 2023 am 08:26 AM

随着数据量的不断增加,数据库的性能成为了一个越来越重要的问题。数据冷热分离处理是一种有效的解决方案,它可以将热点数据和冷数据进行分离,从而提高系统的性能和效率。本文将介绍如何使用Go语言和MySQL数据库进行数据冷热分离处理。一、什么是数据冷热分离处理数据冷热分离处理是一种将热点数据和冷数据进行分类处理的方式。热点数据是指访问频率高、对性能要求高的数据,冷数

使用Go语言进行MySQL数据库的数据增量备份的方法使用Go语言进行MySQL数据库的数据增量备份的方法Jun 17, 2023 pm 02:28 PM

随着数据量的增加,数据库的备份变得越来越重要。而对于MySQL数据库,我们可以借助Go语言实现自动化的增量备份。本篇文章将简单介绍如何使用Go语言进行MySQL数据库的数据增量备份。一、安装Go语言环境首先,我们需要在本地安装Go语言环境。可以前往官网下载相应的安装包并进行安装。二、安装相应的库Go语言提供了许多访问MySQL数据库的第三方库,其中较为常用的

如何使用MySQL数据库进行时间序列分析?如何使用MySQL数据库进行时间序列分析?Jul 12, 2023 am 08:39 AM

如何使用MySQL数据库进行时间序列分析?时间序列数据是指按照时间顺序排列的数据集合,它具有时间上的连续性和相关性。时间序列分析是一种重要的数据分析方法,可以用于预测未来趋势、发现周期性变化、检测异常值等。在本文中,我们将介绍如何使用MySQL数据库进行时间序列分析,并附上代码示例。创建数据表首先,我们需要创建一个数据表来存储时间序列数据。假设我们要分析的数

如何使用Go语言进行可靠的MySQL数据库连接?如何使用Go语言进行可靠的MySQL数据库连接?Jun 17, 2023 pm 07:18 PM

随着大量的数据需要存储和处理,MySQL已经成为了应用开发中最常用的关系型数据库之一。而Go语言由于其高效并发处理和简洁的语法,也越来越受到开发者的欢迎。本文就将带领读者通过Go语言实现可靠的MySQL数据库连接,让开发者能够更加高效地查询和存储数据。一、Go语言连接MySQL数据库的几种方式Go语言中连接MySQL数据库通常有3种方式,分别是:1.第三方库

使用Go语言进行MySQL数据库的数据迁移的方法使用Go语言进行MySQL数据库的数据迁移的方法Jun 17, 2023 am 09:01 AM

随着业务的增长和数据库版本升级等因素,数据库迁移变得越来越普遍。在进行数据迁移时,选择合适的工具和语言非常重要。本文将介绍如何使用Go语言进行MySQL数据库的数据迁移。安装MySQL驱动在使用Go语言进行MySQL数据库迁移前,需要首先安装MySQL驱动。在Go语言中,有很多MySQL驱动可供选择。在本文中,我们将选择最常用的官方MySQL驱动包-"dat

MySQL数据库和Go语言:如何进行数据缓存处理?MySQL数据库和Go语言:如何进行数据缓存处理?Jun 17, 2023 am 10:05 AM

近年来,Go语言越来越受到开发人员的青睐,成为开发高性能Web应用程序的首选语言之一。MySQL也作为一种流行的数据库,使用广泛。在将这两个技术结合起来使用的过程中,缓存处理是非常重要的一环。下面将介绍如何使用Go语言来处理MySQL数据库的缓存。缓存的概念在Web应用程序中,缓存是为了加快数据的访问速度而创建的一种中间层。它主要用于存储经常被请求的数据,以

MySQL创建标签表实现文章标签功能的实现步骤MySQL创建标签表实现文章标签功能的实现步骤Jul 02, 2023 pm 04:17 PM

MySQL创建标签表实现文章标签功能的实现步骤标签是一种常用的分类方式,它可以帮助我们更好地组织和检索文章。在许多网站和应用程序中,都会有文章标签的功能。本文将介绍如何使用MySQL创建标签表,并实现文章标签的功能。步骤1:创建标签表首先,我们需要创建一个用于存储标签的表。在MySQL中,可以使用以下命令创建标签表:CREATETABLEtags(

使用Go语言进行MySQL数据库的数据导入导出过滤的方法使用Go语言进行MySQL数据库的数据导入导出过滤的方法Jun 17, 2023 pm 04:04 PM

随着互联网和大数据时代的到来,数据处理成为了一项必备的技能。MySQL作为目前世界上最流行的关系型数据库管理系统,一直以来在数据处理领域受到了广泛的应用。MySQL具有性能高、易用性好、灵活性强等优点,但数据导入导出过程中可能会存在重复或无效数据,因此本文将介绍如何使用Go语言进行MySQL数据库的数据导入导出过滤的方法。一、环境搭建安装MySQL数据库在开

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)