The forgotten pattern lock on Xiaomiβs smartphone is a situation that even power users face. The main problem is that most standard unlocking methods (such as Mi Account) require a factory reset, resulting in the complete loss of photos, contacts and apps. However, there are methods to bypass the lock without deleting data β if you act quickly and correctly.
In this article, we will discuss 5 working ways to remove the pattern lock on Xiaomi, Redmi and POCO devices (including the models from 2023-2026 on MIUI 14/15). Importantly, the effectiveness of methods depends on the firmware version, the availability of debugging over USB and the associated Mi Account. Some options work only when strict conditions are met - we will also describe them in detail.
1 Unlocking with Mi Account (if the phone is connected to the Internet)
The most official and safe way is to use a linked Mi Account. It is suitable if:
- πΆ The phone is connected to Wi-Fi or mobile network.
- π Remember the username and password from Mi Account.
- π± Synchronization with the account is enabled on the device (checked in Settings). β Mi Account β Synchronization).
After 5 failed attempts to enter the pattern lock, the system will offer the option Forgot the password?. Click on it and follow the instructions:
- Enter the email or phone number associated with the Mi Account.
- Confirm your identity via SMS or email.
- Create a new pattern lock or PIN-code.
β οΈ Note: If two-factor authentication is enabled on your device, you will need access to a backup email or Google Authenticator app. Without this, unlocking through your account is impossible.
This method works on all modern models (Xiaomi 13/14, Redmi Note 12/13, POCO F5/X5), but requires an active Internet connection. If Wi-Fi is turned off, try connecting to the network through the recovery mode (discussed below).
2. use ADB (if USB debugging is enabled)
If the phone has previously been activated debugging via USB (Settings β About Phone β MIUI Version β 7 times press to unlock the developer mode), you can delete the key file via Android Debug Bridge (ADB).
- π Debugging by USB plugged.
- π» You have access to a computer with installed Xiaomi drivers and ADB.
Step-by-step:
- Connect your phone to your PC through USB-cable.
- Open the command line (Windows) or terminal (macOS/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
rebootOnce you reboot, the pattern lock will be reset, and if the su command doesn't work, then there are no root rights on the device, 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β οΈ Attention: MIUI 14/15 The path to the key files may be different. If the commands don't work, check the current paths through adb shell ls. /data/system/.
Install Xiaomi drivers on PC|Download ADB Tools (platform-tools)|Enable debugging on USB on the phone (if possible)|Prepare original USB-cable (not charging!)
-->
3. Unlock through Recovery Mode (TWRP)
If you have a custom TWRP recap on your phone, you can manually delete the pattern lock files, which is suitable for advanced users and requires:
- π οΈ Established TWRP Recovery (not standard Mi Recovery).
- π Battery charge of at least 50% (to avoid failures).
- π Backup of data (recommended, but not necessarily).
Instructions:
- Turn off the phone.
- Press Volume Up + Power to Enter TWRP.
- Go to Advanced β File Manager.
- Delete files: /data/system/gesture.key /data/system/locksettings.db /data/system/locksettings.db-wal /data/system/locksettings.db-shm
Reset the device.
If after the reboot there is a request for input PIN-In the code (instead of the pattern lock), enter any set of numbers β the system will let you go further.
| Xiaomi model | Support for TWRP | Risk of data loss |
|---|---|---|
| Xiaomi 13/14 | β No official version. | High (brick possible) |
| Redmi Note 12 Pro+ | β Yes (unofficial assemblies) | Medium. |
| POCO F5 | β Yes. | Low. |
| Redmi 10C | β Yes. | Low. |
β οΈ Attention: Installation TWRP New Xiaomi models (2023-2026) can lead to locking the bootloader and turning the phone into a βbrickβ. XDA Developers.
4. Circumvention through service codes (for older models)
On Xiaomi devices before 2019 (on MIUI 10 and below), sometimes bypassing service codes worked.The method is not guaranteed, but can help if other methods are not available.
Try the following combinations:
- π Dial in the dial number: # # #7378423## (service menu).
- π’ Go to Service tests β Security β Lock screen and try to reset the key.
- π± On some models (Redmi) 4/5) code: ##3646633## β Security β Clear lock data.
If the codes don't work, the manufacturer has closed the vulnerability in the new firmware. Don't try random combinations, it can cause hardware failure.
Why did the service codes stop working?
5. Contact the Xiaomi Service Center (guarantee cases)
If the independent attempts are unsuccessful, you can contact the official service center. Xiaomi can unlock the device without losing data if:
- π You have a check or a warranty card (proof of possession).
- π Phone linked to Mi Account with confirmed email.
- π± The model is not blacklisted (stolen/lost devices).
The procedure takes from 1 to 3 days, the cost of the service is from 1000 to 3000 rubles (depending on the model and region), in some cases, unlocking is free, if the device is warranted.
List of official Xiaomi service centers in Russia:
- π Moscow: 12 addresses (including M.Video, Svyaznoy).
- π St. Petersburg: 8 addresses (Marshala Govorov Street, 35, etc.).
- π Regions: check on the official website.
β οΈ Attention: Unofficial services often offer "unlock without loss of data" for 500-800 rubles. Risks: installing spyware, damaging firmware or stealing data.
π‘
Before visiting the service center, take a screenshot of the IMEI phone (on the box or via the *#06# command) and this will speed up the confirmation process.
What do you do if nothing helps?
If all of these methods fail, you'll have a hard reset through Mi Recovery, which will cause you to lose data, but it will return access to your phone.
- Turn off the device.
- Press Volume Up + Power before the Mi logo appears.
- Choose Wipe Data β Wipe All Data.
- Confirm the reset and wait for the reset.
Once reset, the phone will look like new, so you can recover the data.
- π² Restore contacts and notes via Mi Account (if sync was enabled).
- πΌοΈ Photos and videos can be returned from Google Photos or Mi Cloud.
- π₯ Installed apps are restored from the Mi App Store (Section "My apps").
If the βFind Deviceβ feature (Settings β Mi Cloud β Find the device) was enabled on the phone, try remotely locking the phone and setting a new password through the i.mi.com web version.
π‘
Hard reset is the last option. Before you do it, make sure that your phone has de-linked to your Google account (FRP), or you will need to enter your old account details after the reset.