Home Database Mysql Tutorial MySQL忘记密码怎么修改密码_MySQL

MySQL忘记密码怎么修改密码_MySQL

Jun 01, 2016 pm 01:26 PM
change Password safe mode forget the password

bitsCN.com

MySQL的 root 帐号密码默认为空,经常都有修改密码后忘记密码的事。如果忘记了root 帐号密码,那该怎么修改密码呢?这里有一个可行的方法,就是在MySQL安全模式下(跳过权限检查)修改密码的方式来解决这个问题。本文分别对Windows环境与Linux环境下介绍MySQL忘记密码时修改密码的方法,希望帮助初学者解决丢失密码的烦恼。

Windows下MySQL重置密码

通常MySQL都是安装成Windows服务运行的。

1、启动cmd命令窗口:

# 关闭MySQL服务D:/MySQL/bin>sc stop mysql# 以安全模式启动MySQLD:/MySQL/bin>mysqld --skip-grant-tables
Copy after login

2、不要关闭,再启动一个新的cmd命令窗口:

# 登录MySQL数据库D:/MySQL/bin>mysql -u root -pmysql> use mysql;mysql> update user set password=password("123456") where user="root";mysql> flush privileges;
Copy after login

3、关闭以上两个窗口,启动MySQL服务

# 启动MySQL服务C:/>sc start mysql
Copy after login

Linux下MySQL重置密码

Linux下重置密码的操作与Windows下类似。

# 停止MySQL服务[root@www ~]# /etc/init.d/mysql stop# 以安全模式启动MySQL[root@www ~]# /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
Copy after login

# 登录MySQL[root@www ~]# mysql -u root -pmysql> use mysql;mysql> update user set password=password("123456") where user="root";mysql> flush privileges;
Copy after login
# 启动MySQL服务[root@www ~]# /etc/init.d/mysql start
Copy after login

bitsCN.com
Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1248
24
How to remove graphics card driver in safe mode How to remove graphics card driver in safe mode Feb 20, 2024 am 11:57 AM

How to uninstall the graphics card driver in safe mode With the continuous development of technology, computers have become one of the indispensable tools in people's lives and work. In the process of daily use of computers, netizens often encounter various problems, among which graphics card driver problems are a relatively common one. When there is a problem with the graphics card driver, sometimes we need to uninstall the driver in safe mode. This article will introduce the steps on how to uninstall the graphics card driver in safe mode. What is safe mode? Safe mode is a special mode used to repair and resolve computer problems. When electricity

How to reset password and unlock screen on vivo X60 Pro? How to reset password and unlock screen on vivo X60 Pro? Jan 05, 2024 pm 08:02 PM

The lock screen password of a mobile phone is an important means of protecting personal privacy, and its importance is self-evident. Although smartphones now support fingerprint unlocking and face recognition unlocking, you still need to enter the lock screen password every time you turn on the phone, and fingerprint recognition may occasionally fail. What should you do if you unfortunately forget your lock screen password? The following is a tutorial for unlocking vivoX60Pro after forgetting the password. VivoX60Pro Forgot Password Unlocking Tutorial When you enter the wrong lock screen password five times in a row on vivoX60Pro, the phone will automatically lock. If you forget your password, the only solution is to reset it. The following is a detailed tutorial on resetting the lock screen password on vivoX60Pro. One way to reset your lock screen password is through a security question. This is

What to do if you forget your oppo password 'Must-see: Oppo mobile phone forgotten password recovery tutorial' What to do if you forget your oppo password 'Must-see: Oppo mobile phone forgotten password recovery tutorial' Feb 07, 2024 pm 04:18 PM

As a necessity in today's life, mobile phones must be in many people's bags. In order to ensure the safety of the mobile phone, some friends will set a password when using it. It is precisely because of this that some people forget the password. Let’s take the Oppo mobile phone as an example and let’s see how to unlock the Oppo mobile phone if you forget the password. How to Unlock an Oppo Phone If You Forgot the Password? It is not uncommon to encounter the situation of forgetting the password on an Oppo phone. Fortunately, there are many solutions. One of the commonly used methods is to solve the problem through the [Desktop] - [Cloud Service] - [Retrieve Phone] function on the mobile phone. Just turn on the switch to retrieve your password. In addition, you can also log in to the cloud service webpage through your mobile phone or computer and enter your account password to solve this problem. No matter which method,

How to unlock the phone if I forget the password on my Apple phone How to unlock the phone if I forget the password on my Apple phone Mar 08, 2024 pm 02:46 PM

Forgetting the lock screen password of your Apple phone is a common problem, but it is also an annoying thing. If you encounter this problem, don’t worry because there are many ways to help you unlock your iPhone. Below we will introduce you four simple methods to unlock iPhone lock screen. How to unlock the iPhone if you have forgotten the password. Method 1: Use the "Forgot Password" function. If you forget the iPhone lock screen password, you do not need to reset the phone or use iTunes to restore it. In the latest version of iOS, there is a "regret medicine" function that can help you reset your password. When you enter the wrong password multiple times in a row, it will enter security lock mode. In this mode, you can select "Forgot Password" and then enter your

How to smoothly switch Win11 system from safe mode to normal mode How to smoothly switch Win11 system from safe mode to normal mode Mar 27, 2024 pm 04:31 PM

When the computer encounters a problem, it needs to enter safe mode for troubleshooting and repair. After the problem is solved, how to smoothly switch the system back to normal startup mode? The following brings you a detailed operation plan on how to smoothly switch the Win11 system from safe mode to normal mode. Let’s take a look. Operation method 1. In safe mode, click "Start" in the taskbar in the lower left corner and select "Run" in the option list. 2. In the pop-up window, enter "msconfig" and press Enter to open. 3. After entering the new window, click the "General" tab at the top, then find "Start normally (load all device drivers and services)" at the bottom and check it. Extended Reading Security and Protection Windows Firewall Settings Error Code Installation T

How to change the password of Amap_How to change the password of Amap How to change the password of Amap_How to change the password of Amap Apr 01, 2024 pm 01:56 PM

1. First find [Amap] on your mobile phone and open it. 2. Then switch to the [My] tab and click the settings icon in the upper right corner to enter. 3. Click [Account and Security] to enter. 4. Then click [Login Password] to enter. 5. Finally enter the password and click [Confirm Modification] to complete.

A simple tutorial to enter safe mode in dellwin10 A simple tutorial to enter safe mode in dellwin10 Dec 30, 2023 pm 12:49 PM

How to enter the safe mode of Dell computer win10 system? When our computer has a driver error or other minor faults, entering safe mode is a good solution. Today I will teach you how to enter safe mode on Dell. How to enter safe mode in dellwin10 1. Click the Start button, select Power, hold down the shift key on the keyboard, and then click "Restart". 2. After restarting, enter the menu and select "Troubleshooting" first. 3. Then select "Advanced Options". 4. Then select "Startup Settings". 5. At this point, click "Restart" to enter the "Safe Mode" selection menu. 6. You can choose the type of entry according to the situation at that time.

Detailed explanation of the practical application of win10 safe mode Detailed explanation of the practical application of win10 safe mode Dec 31, 2023 am 11:05 AM

Many users will enter safe mode when using computers or when there is a problem with the computer. However, many users may not know the use of safe mode. Today I will take you to understand the important role of safe mode. . What is the use of win10 safe mode: Answer: Safe mode can easily detect and repair computer system errors. It helps users easily repair some system errors and gets twice the result with half the effort. Normally we do not enter the computer safe mode, but when there are some difficult-to-solve problems in the system, the safe mode can be used to solve them more conveniently. Safe mode works by booting the computer without loading third-party device drivers, causing the computer to run in system minimal mode so that users can

See all articles