The forgotten pattern lock on Xiaomiβs smartphone is a situation that one in five users face. The main problem is that most standard instructions suggest resetting the device to factory settings, which leads to the loss of all data β photos, contacts, messages. But there are legal ways to get around the lock without formatting memory, if you act carefully and follow proven algorithms.
In this article, we will discuss 5 working methods for unlocking the pattern lock on Xiaomi (including the Redmi Note 12 Pro+, POCO X5 Pro, Black Shark 5 and others) that will save your data. Importantly, the effectiveness of the methods depends on the version of MIUI (12-14), the status of the Mi Account and the availability of debugging over USB. Not all methods are universal β some require preliminary preparation (for example, linking the device to a Xiaomi account).
Before you start, check:
- πΉ Is the phone connected to the Internet (Wi-Fi/Mobile data? is critical for Mi Cloud methods.
- πΉ Have you previously activated Find the device in your Mi Account settings?
- πΉ Is there access to a computer with drivers installed? ADB and Fastboot?
1 Unlocking through Mi Account (official method)
The most reliable method is if your Xiaomi is linked to your Mi Account and it has the Find Device feature enabled. It works on all models with MIUI 10 and later, including Redmi 10C, POCO F4, Xiaomi 13 Lite.
Algorithm of action:
- Go to i.mi.com and log in with the same account as you do on your phone.
- In the Devices section, select a locked smartphone.
- Click Unlock the device β Remove the screen lock.
- Confirm the action via SMS or email.
β οΈ Note: If the phone is disconnected, this method will not work, and Xiaomi can request proof of identity (passport scan) if you suspect a hack.
2.Use of Fastboot Mode (for advanced users)
The method is suitable if the phone is enabled debugging by USB (Settings β The phone. β Version. MIUI β 7 taps to activate developer mode. Requires a computer with drivers installed ADB and Fastboot.
Step-by-step:
- Turn off your phone and press the Power button + Volume down to log into the Fastboot.
- Connect the device to the PC and open the command line (Win + R β enter cmd).
- Enter the command to check the connection: fastboot devices If the device is displayed, continue.
- Delete the file with the pattern lock: fastboot erase gesture.key or for newer versions of MIUI: fastboot erase locksettings.db
- Reboot the phone: fastboot reboot
After the reboot, the screen lock will be reset, but the data will remain intact.
Install drivers ADB/Fastboot|Enable debugging on USB phone-on|Download the Android platform SDK|Prepare. USB-cable (original)
-->
3. Unlock via TWRP Recovery (for stitched devices)
If your Xiaomi has a custom TWRP recap, you can manually delete the file with the pattern lock.The method works on the Redmi K50, POCO F3 GT and other models with an unlocked bootloader.
Instructions:
- Enter TWRP (Plug Power Button + Volume Up).
- Select Advanced β File Manager.
- Go to /data/system/ and delete files: gesture.key locksettings.db locksettings.db-wal locksettings.db-shm
Reboot the phone.
β οΈ Attention: Incorrect actions in TWRP If you're not sure, use other methods.
What if TWRP asks for a password?
4. Bypassing locks through service codes (for older versions of MIUI)
On devices with MIUI 8-11 (e.g. Redmi 5 Plus, Mi A2), service codes sometimes trigger to reset the pattern lock.
Try entering in the dialer:
- ##7780## - Reset settings (app data will be saved).
- #3646633## β Engineer Mode β Reset Screen Lock (not available on all models)
If the codes donβt work, move on to other ways.
π‘
Before entering service codes, check if the keyboard is locked on the lock screen. Try calling an Emergency Call and entering the codes from there.
5. Unlock via ADB (if debugging was enabled)
If the phone is pre-installed on debugging USB, You can remove the pattern lock through ADB It's a data-free method. MIUI 12β14.
Instructions:
- Connect your phone to your PC and open the command line.
- Enter the commands in turn: adb shell su rm /data/system/gesture.key rm /data/system/locksettings.db rm /data/system/locksettings.db-wal rm /data/system/locksettings.db-shm reboot
Once the reboot is over, the lock will be removed, and if the su command doesn't work, then there's no root permission on the phone.
π‘
USB debugging should be enabled before the phone locks, and if it's not activated in advance, it won't work.
Comparison of Unlocking Methods
| Method | Conditions required | Data retention | Difficulty | Suitable models |
|---|---|---|---|---|
| Mi Account | Account binding, Internet | β Yes. | β | All of them MIUI 10+ |
| Fastboot | Debugging by USB, PC | β Yes. | βββ | All with the unlocked bootloader |
| TWRP | Set up recaveri, root | β Yes. | ββββ | Embroidery devices |
| Service codes | MIUI 8β11 | β Yes. | β | Redmi 4/5, Mi A1/A2 |
| ADB | Debugging by USB, PC | β Yes. | ββ | All with MIUI 12+ |
What do you do if nothing helps?
If neither method works, there are two options:
- Contact Xiaomi Service Center with a confirmation of purchase (check or box) They can unlock the phone officially, but the data may be lost.
β οΈ Warning: Do not use questionable unlock programs (such as Mi Account Unlock Tool) that often contain viruses or can permanently block the user from using the software. IMEI device.