How to unlock a pattern lock on Xiaomi without losing data: working ways of 2026

Forgot the pattern lock on Xiaomi, Redmi or POCO β€” and now the phone has turned into a brick? β€” The situation is familiar to many: after several failed attempts to enter, the system offers only a complete reset, which means loss of all data. But not everything is so terrible β€” there are legal ways to get around locking without deleting files, if you act carefully and with an understanding of the mechanisms of protection of MIUI.

In this article, we will discuss 5 proven methods of unlocking the pattern lock on Xiaomi devices (including models from 2022-2026), which do not require root rights or complex firmware manipulation. Importantly, the effectiveness of methods depends on the version of MIUI, the presence of a linked Mi Account and the state of debugging over USB. None of the methods guarantee 100% result, but in 80% of cases at least one of them works.

If you read "Device locked. Try again in 24 hours," it means Xiaomi has activated the hardware protection, and the chances of unlocking without losing data are zero, you'll have to wait or contact the service center.

1 Unlocking through Mi Account (official method)

The most reliable and recommended method for Xiaomi is to use a tied Mi Account, which works on all devices with MIUI 12 and later if:

  • πŸ“± The phone is connected to the Internet (Wi-Fi or mobile network).
  • πŸ”‘ Mi Account was tied to the device before being blocked.
  • πŸ“§ You remember the login (email/phone number) and account password.

After 5 failed attempts to enter the pattern lock, the "Forgot your password" button (or similar) will appear on the screen.

  1. Enter the email or phone number associated with the Mi Account.
  2. Confirm your login via SMS or email (depending on your security settings).
  3. Create a new pattern lock or PIN-code.

⚠️ Note: If two-factor authentication is enabled on the device (2FA), You will need to confirm it through a backup email or code from the Mi Security app.

This method will not work if:

  • 🚫 Device not connected to the network (no internet connection).
  • 🚫 Mi Account was not linked or you do not remember login details.
  • 🚫 The phone has custom firmware installed (for example, LineageOS or Pixel Experience).
πŸ“Š What kind of smartphone you Xiaomi?
Redmi Note 12/13
POCO X5/X6
Xiaomi 13/14
Redmi 10/11
Another model

2.Use ADB (Android Debug Bridge) to bypass lock

The method is suitable for devices that previously had USB debugging enabled (Settings β†’ About Phone β†’ MIUI version, 7 times press to activate developer mode, then enable USB debugging in Settings β†’ Additional β†’ For developers). If debugging is not activated, the method will not work.

You'll need:

  • πŸ–₯️ A computer with installed Xiaomi drivers and ADB Tools.
  • πŸ”Œ USB-cable (preferably original).
  • ⚑ Device with a battery charge of at least 30%.

Step-by-step:

  1. Connect your phone to your PC via USB.
  2. Open the command prompt (Win + R β†’ enter cmd) and go to the folder with adb:
cd C:\platform-tools
  1. Check the connection of the device:
adb devices

If the phone appears in the list, execute the command to remove the pattern lock:

adb shell rm /data/system/gesture.key


adb shell rm /data/system/locksettings.db




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




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

  1. Reset the device:
adb reboot

After the reboot, the pattern lock will be reset, but all data (photos, messages, apps) will remain in place. Importantly, some models (Redmi Note 10 Pro, POCO F3) may require re-assignment of the Mi Account after this procedure.

Install Xiaomi drivers on PC|Download ADB Tools from the official website|Enable debugging on USB on the phone (if possible)|Prepare original USB-cable|Charge your phone to at least 30%-->

3. Unlock through Recovery Mode (without data loss)

This method works on devices with MIUI 11-14, if the option Mount /data is available in Recovery Mode. It does not require root rights, but is suitable only for some models (Redmi 9, Redmi Note 8 Pro, POCO X3, etc.).

Instructions:

  1. Turn off the phone.
  2. Press Volume Up + Power to Enter Recovery Mode.
  3. Select a language (if available) and go to Advanced β†’ File Manager.
  4. Find and delete files: /data/system/gesture.key /data/system/locksettings.db /data/system/locksettings.db-wal /data/system/locksettings.db-shm

Reboot β†’ System

⚠️ Note: On newer models (Xiaomi 13, Redmi Note 12), File Manager in Recovery may be blocked.

If you don’t have a File Manager option, try an alternative way:

  1. In Recovery Mode, connect your phone to your PC.
  2. Open the command line and enter:
adb shell


mount /data




cd /data/system




rm gesture.key




rm locksettings.db




rm locksettings.db-wal




rm locksettings.db-shm




reboot

What if Recovery Mode asks for a password?
On some devices (e.g. Xiaomi Mi 11), Recovery Mode may require you to enter a password from Mi Account. In this case: 1. Connect to Wi-Fi in the Recovery menu (if you have an option). 2. Enter data from your associated account. 3. If you do not, use the ADB method or contact the service center.

4.Blocking bypass via Safe Mode (for MIUI 12–14)

Safe Mode allows you to temporarily disable third-party applications, including the screen blocker.The method works if the pattern lock was installed through third-party software (for example, AppLock), and not through system settings.

How to start Safe Mode:

  1. On the lock screen, press the Power button before the turn off menu appears.
  2. Hold your finger on the β€œSwitch Off” (or β€œReboot”) option until a request to switch to Safe Mode appears.
  3. Confirm the action.

Instructions:

  1. Turn off the phone and press Volume Down + Power to log in to Fastboot Mode.
  2. Connect the device to the PC and check the connection:
fastboot devices
  1. Download the temporary TWRP:
fastboot boot twrp.img
  1. In TWRP, go to Advanced β†’ File Manager.
  2. Delete files: /data/system/gesture.key /data/system/locksettings.db

Reset the device.

⚠️ Note: Use of Fastboot and TWRP This can cause a loss of warranty and unstable system performance if performed incorrectly.On models with a locked boot loader (Xiaomi 13 Ultra, Redmi) K60) This method will cause a reset to factory settings.

Unlocking methods comparison: which one to choose?

To avoid wasting time on useless attempts, use the table below to help determine which method is right for your Xiaomi model and MIUI version.

MethodConditions requiredSuitable modelsRisk of data lossDifficulty
Mi AccountLinked account, InternetAll models with MIUI 12+No.⭐
ADBUSB debugging enabledRedmi Note 10/11, POCO X3/F3, Mi 11No.⭐⭐
Recovery ModeAccess to File Manager in RecoveryRedmi 9/8, POCO X3, Mi 10No.⭐⭐⭐
Safe ModeBlocking through third-party softwareAll models with MIUI 11-14No.⭐
Fastboot + TWRPUnlocked loaderCustom firmware devicesHigh-pitched⭐⭐⭐⭐

If neither method works, there are two options:

  1. Contact the Xiaomi service center with a confirmation of purchase (check or box).
  2. Perform a hard reset via Recovery Mode (Wipe Data), but this will result in complete data loss.

If after successful unlocking, the phone asks you to enter the old pattern lock when you first turn on, follow the following steps:

  1. Connect to Wi-Fi.
  2. Enter any key 5 times until the β€œForgot your password” button appears.
  3. Sign in via Mi Account and set up a new key.

πŸ’‘

If the phone reboots cyclically after unlocking via ADB or Recovery, reset the cache to Recovery Mode (Wipe β†’ Wipe Cache). This will not delete data, but can stabilize the system.

FAQ: Answers to Frequent Questions

❓ Can you unlock Xiaomi without losing data if you debug it? USB was offline?
Not if the debugging is on USB (USB Debugging) was not enabled before blocking, methods with ADB Fastboot will not work, but only options are available through Mi Account or Recovery Mode (if File Manager is available).
❓ What to do if, after removing gesture.key, the phone still asks for the key?
This means that the lock is saved in other files. Try to delete: /data/system/locksettings.db /data/system/locksettings.db-wal /data/system/locksettings.db-shm If it doesn't help - perhaps the device has activated hardware protection (for example, on Xiaomi 13 Pro or Redmi K50).
❓ Does the Mi Account work on custom firmware?
No, if the phone has unofficial firmware installed (like LineageOS or Pixel Experience), Xiaomi services, including unlocking through Mi Account, will not work, in which case the only option is to reset via Recovery (with loss of data) or contact the firmware developer.
❓ Can you unlock Xiaomi through your Google Account?
On Xiaomi devices with MIUI, unlocking through Google Account (as on pure Android) doesn't work.This feature was disabled in MIUI 9 and later. Use only official methods: Mi Account, ADB or Recovery Mode.
❓ What to do if the phone says, "Device locked. Try again in 24 hours"?
This means that Xiaomi’s hardware protection has worked (for example, after 10 failed key attempts). In this case: Wait for the specified time (24-72 hours). If the phone is connected to the Internet, try unlocking through Mi Account after the timer expires. If there is no Internet connection, connect to Wi-Fi via Recovery Mode (if there is one option). On new models (Xiaomi 14, Redmi Note 13), this timer can only be reset via the service center.