MySQL 忘记root密码解决办法_MySQL
概述
很多时候mysql安装完root用户的默认密码不为空,这时候就需要通过其它办法登入到mysql重置密码。
步骤
方法1:查看/root/.mysql_secret文件
安装mysql第一次会生成一个随机密码,可以用该密码登入,随机的密码已经生成 可以在 '/root/.mysql_secret'. 中找到。
方法2:使用mysqladmin
mysqladmin无法修改密码
mysqld_safe --skip-grant-tables &
mysql -uroot -p
use mysql;
update user set password=PASSWORD("newpassword")where user="root";
flush privileges;
quit
方法3:添加"skip-grant-tables"
在/etc/my.cnf [mysqld] 配置部分添加"skip-grant-tables"
重启mysql服务
service mysqld restart
登入mysql
mysql -uroot -p mysql
use mysql;
update user set password=password("password") where user='root';
更新
flush privileges;
删除/etc/my.cnf [mysqld] 配置部分的"skip-grant-tables"
重启mysql服务
service mysqld restart
使用新密码登入
mysql -uroot -p
修改完密码第一次登入可能会报错‘ERROR 1820 (HY000): You must SET PASSWORD before executing this statement ’,需要重新修改当前登入密码。
修改当前用户密码
SET PASSWORD = PASSWORD('123456')

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

AI Hentai Generator
Generate AI Hentai for free.

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

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

Wireless networks have become an indispensable part of people's lives in today's digital world. Protecting the security of personal wireless networks is particularly important, however. Setting a strong password is key to ensuring that your WiFi network cannot be hacked by others. To ensure your network security, this article will introduce in detail how to use your mobile phone to change the router WiFi password. 1. Open the router management page - Open the router management page in the mobile browser and enter the router's default IP address. 2. Enter the administrator username and password - To gain access, enter the correct administrator username and password in the login page. 3. Navigate to the wireless settings page - find and click to enter the wireless settings page, in the router management page. 4. Find the current Wi

Wireless networks have become an indispensable part of our lives with the rapid development of the Internet. In order to protect personal information and network security, it is very important to change your wifi password regularly, however. To help you better protect your home network security, this article will introduce you to a detailed tutorial on how to use your mobile phone to change your WiFi password. 1. Understand the importance of WiFi passwords. WiFi passwords are the first line of defense to protect personal information and network security. In the Internet age, understanding its importance can better understand why passwords need to be changed regularly. 2. Confirm that the phone is connected to wifi. First, make sure that the phone is connected to the wifi network whose password you want to change before changing the wifi password. 3. Open the phone’s settings menu and enter the phone’s settings menu.

This article will explore how to solve the problem of wrong password, especially the need to be careful when dealing with BitLocker warnings. This warning is triggered when an incorrect password is entered multiple times in BitLocker to unlock the drive. Usually, this warning occurs because the system has a policy that limits incorrect login attempts (usually three login attempts are allowed). In this case, the user will receive an appropriate warning message. The complete warning message is as follows: The password entered is incorrect. Please note that continuously entering incorrect passwords will cause the account to be locked. This is to protect the security of your data. If you need to unlock your account, you will need to use a BitLocker recovery key. The password is incorrect, beware the BitLocker warning you receive when you log in to your computer

After upgrading the win101909 system, some friends may want to cancel their computer lock screen password. If you don’t know what to do, I think we can find the account options in the computer’s settings window. Let’s take a look at the specific methods. How to cancel the lock screen password in win101909: 1. First press Win+I to open the settings interface. 2. Then find the account--login option, and then set it as shown. How to cancel power-on password login in win101909: 1. Execute regedit during running to open the registry and navigate to the following path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\Cu

Passkey is a more advanced and secure way to log in and can be used with a Microsoft account. This article will guide you how to use Passkey in your Microsoft account, introduce its advantages and the differences with passwords. Before we get into the details, we emphasize that if you frequently forget your passwords or need to log in quickly, Passkey will generally be better for you. What is Passkey? How are they different from passwords? Passwords are an advanced and secure authentication method that can replace traditional password logins. Each application has a unique key, ensuring security and preventing threats like phishing. Users can confirm their identity via email and password, or use facial recognition, fingerprint or security key

How does the "iPhone is not available" security feature work? The basic mechanism that triggers the "iPhone Not Available" message is rooted in the security features of the system's design, which track every incorrect passcode entry. This protection kicks into high gear from the fifth incorrect attempt to unlock the device. Once this milestone is reached, the iPhone sets a temporary lock period of one minute, during which any additional attempts to enter the passcode become futile. This lock duration is not static but follows an escalating pattern. Specifically, after the fifth password attempt, each subsequent incorrect password attempt will cause the lockout timer to be increased by one minute. For example, the sixth incorrect attempt will result in a 2 minute lockout and the seventh incorrect attempt will result in a 3 minute

How to unlock iPhone if you forget password In modern society, mobile phones have become an indispensable part of our lives. Among mobile phones, Apple mobile phones are chosen and trusted by the majority of users due to their stability and security. However, sometimes we also encounter some problems, such as forgetting the iPhone password we set. How to unlock your iPhone if you forget your password? Below we will discuss several common unlocking methods. The first method is to unlock it through the "Retrieve Phone Password" function. First, we want to make sure the phone is connected to the Internet. Then,
