MySQL忘记密码怎么修改密码_MySQL
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
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;
3、关闭以上两个窗口,启动MySQL服务
# 启动MySQL服务C:/>sc start mysql
Linux下MySQL重置密码
Linux下重置密码的操作与Windows下类似。
# 停止MySQL服务[root@www ~]# /etc/init.d/mysql stop# 以安全模式启动MySQL[root@www ~]# /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
# 登录MySQL[root@www ~]# mysql -u root -pmysql> use mysql;mysql> update user set password=password("123456") where user="root";mysql> flush privileges;
# 启动MySQL服务[root@www ~]# /etc/init.d/mysql start

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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

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

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,

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

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

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.

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.

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
