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

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 ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
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)

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 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 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

How to solve the problem that Win11 cannot start and enter safe mode How to solve the problem that Win11 cannot start and enter safe mode Jan 02, 2024 pm 05:05 PM

Many times, we can solve the problem of win11 blue screen by entering safe mode. However, because some friends are not familiar with the system and computer, they don’t know how to enter safe mode when the blue screen fails to boot. In fact, we can enter through the power button. Let’s take a look below. How to enter safe mode when Windows 11 fails to boot with a blue screen. Method 1: 1. First, we continuously use the computer’s power button (power on button) to restart the system. 2. After three consecutive operations or more, the computer will enter the system repair option. 3. Select "Troubleshooting", enter the troubleshooting and then enter "Advanced Options" 4. Find "Startup Settings" in "Advanced Options" and enter it, then select "Restart" 5. After that, you can press according to the prompts "F4

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.

How to automatically skip the power-on password in win10 safe mode How to automatically skip the power-on password in win10 safe mode Dec 28, 2023 pm 06:57 PM

When many users use computers, they often encounter the problem of directly skipping the power-on password in the boot mode and leaving it untouched. This has caused a lot of trouble to users. It is actually not difficult to solve. Let’s take a look at the win10 security mode. Skip the power-on password. Unable to enter win10 safe mode: 1. Many users are stuck before entering the desktop and there is no password interface. 2. We can force shutdown three to four times. Then the startup settings page will appear and select "Enable Safe Mode". 3. Right-click "Start" and click "Run". 4. Enter "msconfig" in the run window. 5. Click "General" and select "Normal startup". 6. Successfully enter the password interface.

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,

Solution: Deal with the black screen problem of Windows 10 system that cannot enter safe mode Solution: Deal with the black screen problem of Windows 10 system that cannot enter safe mode Jan 09, 2024 am 09:58 AM

When we use the win10 operating system, in some cases we may encounter a black screen on our win10 operating system and be unable to enter the safe mode of the system. Regarding this problem, the editor thinks that it may be because the compatibility of our computer is not very good, or there is a problem with the computer driver, resulting in a black screen and the inability to enter safe mode. So for the specific solution steps, let’s take a look at what the editor did~ What to do if the Windows 10 system has a black screen and cannot enter safe mode. Method 1: 1. Turn on the system and long press the power button to turn it off and then turn it on again. Repeat about three times. 2. When you see the Advanced Options interface, click Advanced Options--"Troubleshooting--"Advanced Options--"Command Prompt. 3. Enter in the prompt: C: ※definite

See all articles