How to change or reset the pattern lock on Xiaomi: 5 working ways

Forgot the combination of the pattern lock on your Xiaomi smartphone? Or just want to change it to a more reliable one? This problem is familiar to many owners of devices with a high-end device. MIUI β€” Especially if the password hasn't been used for a long time. PIN-The pattern lock is harder to remember due to the many possible combinations, and standard reset methods often result in the loss of all data on the phone.

In this article, we will discuss 5 proven methods for changing the pattern lock to Xiaomi, Redmi and POCO – from official (via Mi Account) to alternative (using ADB or Fastboot mode), focusing on the ways that save your files, photos and applications, and learn why some instructions from the Internet stopped working in MIUI 14/15 and how to circumvent new restrictions.

Before you start, make sure you have access to Mi Account (if it was tied to the device) or a backup of important data.Some methods require a PC connection, so prepare in advance. USB-cable and install Xiaomi drivers.

1. Change the pattern lock through settings (if the phone is unlocked)

If you remember the current pattern lock and the phone is unlocked, you can change it in 2 minutes through the standard MIUI menu. This method is suitable for all models - from Xiaomi 11T Pro to Redmi Note 12.

Open Settings β†’ Passwords and security β†’ Screen lock. The system will ask you to enter the current pattern lock or PIN. After that, select the pattern lock option and draw a new combination. Importantly, MIUI requires a minimum of 4 connected points, but for reliability, we recommend using 6-9 dots.

  • πŸ”„ Tip: Use a combination that is easy to play to the touch (such as the letter "Z" or the number "7").
  • πŸ“± Limitation: On some models (e.g, POCO F5) You can not install a pattern lock if you have previously activated Smart Lock.
  • βš™οΈ Additional: In the same menu, you can turn on the option to Show points when entering to see the trajectory of the finger.

If the phone stopped recognizing touching the lock screen after changing the key, try restarting the device. In rare cases, resetting the Launcher settings to Settings β†’ Applications β†’ Application Management β†’ Launcher helps.

πŸ’‘

If you often forget passwords, activate the backup. PIN-It will help unlock your phone if the pattern lock is incorrectly entered 5 times in a row.

2 Unlocking through Mi Account (official method)

If you have forgotten the pattern lock, but the phone is linked to your Mi Account, use the Find Device feature, which works even on a locked screen, but requires an Internet connection (via Wi-Fi or a mobile network).

Instructions:

  1. Go to i.mi.com and log in to your account.
  2. Select the locked device in the list (if there are several).
  3. Press Find the device. β†’ Unlock.
  4. Confirm the action via SMS or email.

After that, the phone unlocks, and you can set a new pattern lock. Attention: this method will only work if the device has enabled Find the device and it is connected to the network.

What to do if the "Find the device" does not work?
If the option is disabled or the phone is not connected to the Internet, try an alternative method: enter the wrong pattern lock 5 times in a row, then click "Forgot your password?" and log in via Mi Account. On some firmware, this method works even without the Internet (account data is cached).

ConditionsMethod of unlockingIs the data preserved?
The phone is connected to Wi-Fi/MobileThrough Mi Account (i.mi.com)βœ… Yes.
No internet, but account is tied5 Wrong Attempts β†’ "Forgot the password?"βœ… Yes.
No binding to the Mi AccountADB or Fastboot⚠️ Partially/no
Installed custom recaveri (TWRP)Delete gatekeeper.password.keyβœ… Yes.

3. Resetting the pattern lock via ADB (without loss of data)

If Mi Account is not tied or working, you can use the Android debugging bridge (ADB).This method requires pre-activation of Developer Mode and USB Debugging, but allows you to bypass the lock without resetting to factory settings.

Step-by-step:

  1. Connect your phone to your PC via USB.
  2. Open the command line (Windows) or terminal (Mac/Linux) and type: 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
  3. After rebooting, the pattern lock will be reset.

If the su command doesn't work, then there are no root rights on the device, in which case, try an alternative method:

adb shell


cd /data/data/com.android.providers.settings/databases




sqlite3 settings.db




update system set value=0 where name='lock_pattern_autolock';




update system set value=0 where name='lockscreen.lockedoutpermanently';




.quit




reboot

Install Xiaomi drivers on PC|Enable Developer Mode (7 taps by build number)|Activate Debugging by USB in developer settings|Download ADB Tools (platform-tools)|Connect your phone to your PC in File Transfer mode-->

⚠️ Attention: Starting with MIUI 14, Xiaomi tightened protection against ADB-If the phone still requires a pattern lock after the commands are executed, try to delete the file. /data/system/locksettings.db through TWRP (if established).

4. Unlock via Fastboot (for advanced users)

If ADB didn’t work or USB debugging wasn’t enabled in advance, you can try resetting the pattern lock via Fastboot mode.This method is suitable for most Xiaomi models, but requires an unlocked bootloader.

Instructions:

  1. Turn off your phone and press the Power button + Volume down to log into the Fastboot.
  2. Connect the device to the PC and check for detection by the command: fastboot devices
  3. Enter the command to reset the lock: fastboot erase userdata Warning: This command will delete all data from the userdata section (including photos and apps)!
  4. Reboot the phone: fastboot reboot

After the reboot, the device will be unlocked, but all settings will be reset to factory. This method is not suitable if the phone is enabled with File-Based Encryption, since after resetting the userdata, the device may require a password to decrypt.

πŸ“Š What kind of unlocking method have you tried?
Through the Mi Account.
ADB
Fastboot
TWRP
Nothing, just reading.

5. Delete the pattern lock via TWRP (for hardened devices)

If your Xiaomi has a custom TWRP reclaimer, you can reset the pattern lock without losing data. This method works on most models, including the Xiaomi 12 Pro, Redmi K50 and POCO X5.

Instructions:

  1. Turn off your phone and press the Power button + Volume up to enter TWRP.
  2. Go to Advanced β†’ File Manager.
  3. Delete the following files: /data/system/gesture.key /data/system/locksettings.db /data/system/locksettings.db-wal /data/system/locksettings.db-shm

Reboot the phone.

If you still request a pattern lock after deleting files, try to delete it further. /data/system/device_policies.xml. On some firmware MIUI 15 This file contains additional blocking policies.

⚠️ Note: If you delete the wrong files in the TWRP, The phone may get stuck on downloading or lose access to certain functions. Before manipulation, back up the data partition via TWRP β†’ Backup.

6.Alternative methods (for older Xiaomi models)

On devices with MIUI 10-12 (for example, Xiaomi Mi 9, Redmi Note 8 Pro) sometimes vulnerabilities that allow you to bypass the pattern lock without reset.

  1. On the lock screen, press Emergency Call.
  2. Enter the combination ##4636## (test menu).
  3. Return to the lock screen – sometimes this results in a reset of the pattern lock.

Another way for old firmware is to connect the keyboard over OTG:

  • Connect. USB-Keyboard to the phone via adapter OTG.
  • On the lock screen, press Enter several times – this can cause an error and temporarily disable the lock.

These methods do not work on all devices and often stop working after MIUI updates. If none of them worked, only a full reset via Fastboot or service center remains.

πŸ’‘

On new firmware (MIUI 14+), most of the β€œholes” to bypass the pattern lock are closed. If the phone is important and there is a lot of data, contact the Xiaomi service center with proof of ownership (check or box).

FAQ: Frequent questions about changing the pattern lock to Xiaomi

Can I change the pattern lock without losing data if USB debugging is not enabled?
No, without pre-activated USB or TWRP debugging, you can't get around the lock without resetting the data. The only official way is to unlock through Mi Account (if it's tied and there's the Internet).
Why does the phone ask for a password to decrypt after reset via Fastboot?
This is because of the encryption enabled (FBE). When you delete userdata, the encryption keys are lost and the device requires a password to access the data, in which case only a complete reset via Fastboot with data formatting: fastboot format userdata will help. ⚠️ Note: This command will delete ALL data without the possibility of recovery.
How do I know if my bootloader is unlocked on my Xiaomi?
Turn off your phone and go to Fastboot (Power + Volume Down). If the bottom of the screen says Unlocked or Device is unlocked, the bootloader is unlocked. If not, you will need official unlock through the Xiaomi website (you need a Mi Account and wait 7-15 days).
Can I recover the data after resetting the pattern lock?
If you backed up your files via Mi Cloud or Google Account, you can recover your data (contacts, photos, some settings) after unlocking your files (music, documents) using specialized programs like Dr.Fone or EaseUS MobiSaver, but the odds are low – MIUI uses default encryption.
Why did the fingerprint and facial recognition stop working after the pattern lock change?
In MIUI, biometrics (fingerprint, face) are tied to the current lock method, and once you change the pattern lock, you need to reconfigure them: go to Settings β†’ Passwords and Security β†’ Fingerprint (or Face Recognition) and add the data again.