Forgot the password from Xiaomi: how to unlock the phone without losing data

When a smartphone owner suddenly finds he or she has forgotten a pattern lock or a digital code, it is much more common than people think, especially for Xiaomi devices where MIUI security can block access after several failed typing attempts. Users often panic, believing that the only way out is a complete factory reset that is guaranteed to destroy all photos, contacts and important documents.

Fortunately, modern versions of Android and the MIUI have lock-bypass mechanisms to save user data. However, the success of the event depends on whether certain preparatory actions, such as linking an account or enabling debugging over USB, were performed in advance. In this article, we will discuss all possible scenarios, from standard recovery methods to more complex technical solutions.

It is important to understand that there is no universal “magic button” that will work for absolutely all models and versions of firmware. Methods that work on the Redmi Note 10 with Android 11 may not be useful on the Xiaomi Mi 9 running an older version of the software.

Use the “Forgot Password” function through your Mi Account

The most reliable and regular way to restore access to the device without data loss is associated with the use of the cloud service Mi Account. If you previously logged in to Xiaomi on a locked phone, your chances of success are maximum. MIUI allows you to reset a pattern lock or pin code, confirming the identity of the owner through the company's servers.

To implement this method, the lock screen must offer the option “Forgot password” or “Forgot the pattern lock” after five incorrect attempts to enter. By clicking this button, the system will require you to enter the username and password from your Mi Account. Entering data from your Google account in this particular window will not help, it requires a Xiaomi account. Once you successfully log in, the lock will be removed, and you will be able to specify a new access code.

⚠️ Note: If the phone is not connected to the internet at the time of the recovery attempt, the confirmation button may not work.

In some cases, especially older versions of MIUI, you may need to click on the reset link. If you don't have one on the lock screen, you may have disabled the feature in the security settings before. Check if you have a linked account by trying to remember if you were logged in to Xiaomi services when you first set up the device.

📊 Do you use Mi Account on your phone?
Yeah, that's the main account.
Yeah, but I rarely do.
No, I only use Google.
I don't know what that is.

Recovery through Google Find My Device

An alternative, but less guaranteed, way is to use Google Find My Device, which previously allowed you to directly change your screen lock password remotely, but in modern versions of Android, this feature has been eliminated for security reasons.

To try this method, you need to log into your Google account from any other device (computer or tablet) through your browser. Go to the official service page and select a locked smartphone from the list of available devices. If the system sees the device, you will be prompted with several actions: call, block or clear the data.

  • 📍 Location: Lets you see where your phone is, which is useful if you’re not sure if you’re holding it.
  • 🔒 Device locking: In rare cases, it allows you to set a new temporary password that will replace the forgotten code.
  • 🗑️ Cleaning the device: an extreme measure that will delete all data, so only use it if the information is not important.

It's worth noting that to run this service, the phone needs to have the Internet on and geolocation activated. If the device is in flight mode or discharged, the command will not be executed. It's also important that the device has the latest Google Play services installed, which is relevant for global firmware versions, but does not always work on Chinese versions of MIUI without flashing.

💡

If Google Find My Device shows the device as “Offline,” try sending a command to lock or clean up — it will run automatically as soon as the phone appears on the network.

Unlocking through debugging via USB and ADB

The most technically sophisticated but powerful method involves the use of the ADB (Android Debug Bridge) toolkit, which only works if the locked phone previously included USB debugging in the developer menu and the computer was given permission to access. If these conditions are met, you can delete the file that stores the access keys through the command line.

First, you need to download and install the Platform-tools package on your computer. Connect your smartphone to your PC through the original one. USB-Open the command line (CMD) or terminal in a toolbox ADB And you type in the connection check command: adb devices. If a device has been listed, it's connected.

adb shell rm /data/system/gesture.key


adb shell rm /data/system/password.key




adb shell rm /data/system/locksettings.db




adb shell rm /data/system/locksettings.db-wal




adb shell rm /data/system/locksettings.db-shm

Executing these commands will delete the files responsible for storing the pattern lock and pin code. Once the device is reboot (adb reboot), you can log in without entering a password or with any arbitrary set of characters. However, if the phone has never connected to this computer before and you have not confirmed debugging, the method will not work due to Android security requirements.

What if the ADB can’t see the device?
Make sure you have drivers installed for your smartphone. USB-cable or port switch, and check if debugging is enabled. USB Developer settings (if you have access to the menu via Recovery or other loopholes).

Third-party utilities to remove the lock

There are many third-party software that promise to unlock Xiaomi’s phone without losing data. Popular solutions include Dr.Fone, Tenorshare 4uKey, and iMyFone LockWiper. These utilities use vulnerabilities in the system or specific firmware bugs to bypass the lock screen.

The effectiveness of these programs varies greatly depending on the phone model and the version of Android. On new devices with updated security, the chances of success without losing data tend to zero. Most often, these tools still offer the “Remove Screen Lock” feature, which is technically a data partition formatting, which leads to loss of information.

ProgrammeXiaomi supportRisk of data lossCost
Dr.FonePartialHigh-pitchedPaid
Tenorshare 4uKeyLimited.Medium.Paid
Android Multi ToolsHigh (ADB)Low (with rights)Free.

When using third-party software, you should be aware of the potential privacy risks: Giving full permissions to access your device to unknown software can lead to a leak of personal data. Always download utilities only from official developer sites and check files with antivirus before launching.

☑️ Checking before using the software

Done: 0 / 1

Precautions and preparations for discharge

If none of the gentle methods worked and you are faced with the need for a full reset, it is crucial to prepare for this process correctly.Reset will return the phone to factory state by removing all user files, applications and settings. However, if you have a backup, you will be able to quickly recover important information.

First of all, check if your contacts and photos are synced to the cloud. For contacts, this can be a Google account or Mi Cloud, for photos, Google Photos or Xiaomi Gallery. Go to the relevant websites from your computer and make sure that your data is there. This will allow you to not worry about losing it after formatting.

⚠️ Warning: After resetting the settings, the phone will require you to enter a Google account that was previously synced with the device (protection) FRP). Make sure you remember the login and password from it, otherwise the phone will turn into a brick».

It is also worth removing the MicroSD card before the reset procedure, if installed. Although modern versions of MIUI usually store application data in internal memory, the card may have personal files that are better not to risk random formatting.

💡

Backup is the only 100% way to ensure data is safe, and set up autosynchronization of important files to the cloud regularly.

Frequently Asked Questions (FAQ)

Can I unlock Xiaomi if my phone is turned off?
No, to unlock without losing data, the phone must be turned on and on. If the device is turned off, it must be charged and turned on. Password reset procedures require an active operating system or access to the Recovery menu, which is also part of the device's software.
What if I forgot my password and my Mi Account?
In this case, the situation is complicated: you will first have to restore access to the Mi Account through the site i.mi.com using a linked phone number or email. Without confirmation of ownership of the account, unlocking the device without loss of data is almost impossible due to the security system FRP.
Will unlocking through a fingerprint work if you forget the pin code?
Normally not. Android requires periodic identification with a pin code or a pattern lock (e.g., after a reboot or after 72 hours) If the system requests a master password, biometrics won't help bypass it.
Does the reset via Mi Account remove photos?
The routine procedure for resetting a password through the Mi Account website or menu on the lock screen DOES NOT delete personal data. It only removes screen protection. However, if you use the Find Device feature for full cleanup (Erase), all data will be permanently deleted.