Forgot the pattern lock on Xiaomi, and the phone has important photos, correspondence or work documents? The situation is familiar to many: after several failed attempts to enter, the system locks the device for 30 seconds, a minute, and then offers to reset all data through Recovery. But what if a factory reset is not an option?
In this article, weβll break down Xiaomiβs legal and semi-official unlocking methods (including Redmi, POCO, Black Shark) without data loss. Important: the effectiveness of the methods depends on the version MIUI (12, 13 or 14), a smartphone model and a linked Mi Account. Some methods require prior preparation, such as the one on. USB-If you don't have any of these, go straight to the section about unlocking through Mi Account.
Warning: Attempts to circumvent the protection can lead to the blocking of the Mi Account (if the device is associated with the account) or the activation of Factory Reset Protection (FRP).
Why Xiaomi is blocking the bypass of the pattern lock
Xiaomiβs MIUI-based smartphones use a multifaceted security system that makes unauthorized access more difficult, and these are key reasons why standard bypass methods (like resetting through Recovery) lead to data loss:
- π File system encryption: Starting with Android 6.0, all user data (photos, messages, apps) are encrypted with a unique key tied to a graphical password or PIN-Without it, the system can't decrypt files even after resetting them.
- π‘οΈ Mi Account Protection. If the phone is synchronized with the Mi Account, after resetting via Recovery, you will need to enter a login / password from the account.
- π« Banning ADB In the latest versions, it's locked. MIUI 13/14 the ability to connect to ADB (Android Debug Bridge without pre-activation USB-debugging.
The manufacturer deliberately limits the way users are circumvented to protect them from data theft, but there are loopholes that allow you to unlock the device without formatting β if you know where to look.
Preparation: What to check before unlocking
Before you start bypassing the pattern lock, answer these questions:
- Is there a Mi Account on your phone (remember your login and password)?
- Whether it was on. USB Debugging (debugging by USB) lock-in?
- Do you have a backup of your data (e.g., in Mi Cloud or on PC)?
- What version of MIUI is installed on the device?
The answer depends on the choice of method. USB-Debugging activated, can be used ADB-commands to delete gesture.key file (where the graphical password is stored). If not, you will have to rely on official Xiaomi tools.
βοΈ Checklist before unlocking
If your phone is under 20%, plug it into charging for 10-15 minutes. Some methods (like Fastboot) require stable power.
Method 1: Unlocking with Mi Account (official method)
The most reliable and legal way is to use a linked Mi Account, which works on most Xiaomi devices if:
- π± The phone is connected to the Internet (Wi-Fi or mobile data).
- π You remember the username (email or phone number) and password from your Mi Account.
- π More than 5 failed attempts to enter a password were not made on the device (otherwise the account may be temporarily blocked).
Instructions:
- On the lock screen, tap the Forgot Password button (or Forgot Password?).
- Select the recovery option through Mi Account.
- Enter your email/phone number and password. If two-factor authentication is enabled, confirm your login via SMS or email.
- Follow the instructions on the screen, and the system will suggest you create a new pattern lock or PIN-code.
β οΈ Note: If you have previously changed your Mi Account password but have not updated it on your phone, additional verification may be required through the user account. SMS backup email.
What if the βForgot Passwordβ button does not appear?
Method 2: Remove gesture.key via ADB (if debugging is enabled)
If the phone has been activated in advance USB-debugging, you can delete the file with a graphic password through ADB. This method works for MIUI 12-14, but requires access to a computer.
What you need:
- π₯οΈ Computer with installed ADB Tools.
- π Original. USB-cable (low-quality cables may not transmit data).
- π± Phone with a charge of at least 30%.
Step-by-step:
- Connect your phone to your PC via USB.
- Open the command prompt (cmd) in the folder with ADB.
- Enter the command to check the connection: adb devices If the device appears in the list, go further. If not, install drivers for your Xiaomi model.
- Delete the file with the pattern lock: adb shell rm /data/system/gesture.key
- Reboot your phone: adb reboot
Once you reboot, the pattern lock will reset and you can install a new one. If the rm command doesn't work, try an alternative path: adb shell rm /data/system/locksettings.db.
π‘
If the phone still requires a password after removing gesture.key, try entering any arbitrary key β sometimes the system misses it as βemptyβ.
Method 3: Unlocking via Fastboot (for stitched devices)
It is suitable for users who have unlocked the bootloader and have experience with Fastboot. If you have never unlocked the bootloader on your Xiaomi, this method will not work.
Warning: Incorrect commands in Fastboot can cause a device to fail completely. Use this method only if you are confident in your actions.
Instructions:
- Turn off the phone. Press Volume down + Power to enter Fastboot mode.
- Connect the device to your PC and check the connection: fastboot devices
- Download custom recovery (such as TWRP) for your model.
- Select recovery: fastboot flash recovery twrp.img (replace twrp.img with your file name).
- Recovery: Fastboot Reboot Recovery
- In TWRP, go to Advanced β File Manager and delete files: /data/system/gesture.key, /data/system/locksettings.db, /data/system/locksettings.db-wal, /data/system/locksettings.db-shm.
- Reboot the phone.
β οΈ Note: On some models (Redmi Note 9 Pro, POCO X3 NFC) post-fix TWRP An anti-rollback can work to lock the device. Before using this method, check the compatibility of your model in the forums. XDA Developers or 4PDA.
Method 4: Unlocking through EDL (for power users)
EDL (Emergency Download Mode) is an emergency firmware mode that allows you to reflash your phone even with a locked bootloader.
- π§ Special cable (EDL cable) or board lintels.
- π» Mi Flash Tool and official firmware for your model.
- π Authorized Mi Account (for new devices).
Step-by-step:
- Download the official firmware for your model (choose the Fastboot version).
- Install the Mi Flash Tool on your PC.
- Put your phone in EDL mode: Turn off the device. Press Volume up + Volume down and connect to your PC via USB. Or disassemble the phone and close the EDL contacts on the board (requires soldering skills).
Mi Flash Tool
Flash
Wait for the firmware to be completed (10-15 minutes).
β οΈ Attention: Firmware through EDL deletes all data unless you use special scripts to save the partition /data. This method is only suitable if other methods have not worked and the data is not critical.
| Method | Conditions required | Data retention | Difficulty |
|---|---|---|---|
| Mi Account | Linked account, Internet | β Yes. | β |
| ADB | On. USB-debugging | β Yes. | ββ |
| Fastboot + TWRP | Unlocked bootloader | β Yes (with the right actions) | βββ |
| EDL | Special cable, firmware. | β No (no scripts) | ββββ |
Method 5: Alternative methods (for older models)
If you have Xiaomi on Android 5-7 (e.g. Redmi 4X, Mi A1), you can try bypassing the pattern lock through service codes or an emergency call.
Method 1: Through the emergency call screen
- On the lock screen, tap the Emergency Call (or Emergency Call).
- Enter the code ##7378423## (some models run #197328640##).
- Go to the service settings menu and find the option to reset the pattern lock.
Method 2: Reset Google Password (for Android 5-6)
- Enter the wrong pattern lock 5 times.
- Tap it Forgot the password? β Enter Google data.
- Enter the login and password from the Google account that was linked to the phone.
β οΈ Note: These methods only work on older versions. MIUI On modern devices (Redmi Note 10 and later) they are useless.
π‘
On devices with MIUI 13/14 and Android 11+, you can bypass the pattern lock without losing data only through Mi Account or ADB (if debugging was enabled in advance).