How to remove the lock from the Xiaomi phone, if you forgot the graphic password without losing data

When a Xiaomi smartphone screen suddenly requires a pattern lock to be entered and the memory refuses to reproduce the correct sequence of dots, it can take anyone by surprise. Panic at such moments is a natural reaction, because the device stores years of correspondence, important work documents and priceless family photos. However, it is absolutely not worth rushing with radical measures, such as a complete reset to factory settings, since there are methods of bypassing protection that allow you to save information.

MIUI device owners often find that standard privacy protections become a barrier to user forgetfulness. Android security algorithms are constantly being improved to close old holes, but Xiaomi’s shell still contains loopholes that power users can exploit.

Before you start taking active actions, you need to clearly understand what type of lock is installed on your device, since the choice of an access recovery strategy depends on this. PIN-In a code or graphical pattern, the chances of success are much higher than if you block it through a Mi Account with Find Device enabled, in which case the security system works at the server level, and it is almost impossible to get around it without authorization without losing files.

📊 What type of lock you have installed?
pattern lock
Digital. PIN-code
Mi-account
Fingerprint.

Use the “Forgot Password” function through the Mi-account

The most legitimate and safe way to restore access is to use the built-in unlock mechanism associated with the Mi Account. This method only works if the locked device has previously logged in to the Xiaomi account and enabled data transfer via mobile network or Wi-Fi. If the screen is locked, but the Internet connection is active, the system can synchronize the unlock command remotely.

To implement this method, you need to take any other device (computer or phone friend) and go to the official website of the cloud service Xiaomi Cloud. By entering your credentials, you get access to the control panel of the device, where the screen erasure feature is available. It is important to note that this method does not work on all versions of MIUI, since in the latest security updates the company has increased protection, but it is worth trying first.

The process is as follows: after logging in to the site, select your device from the list of available gadgets. If the device status is displayed as “Online”, you will be given the option to unlock. Pressing the appropriate button will send a command to the phone and the pattern lock will be reset. However, if the device is offline or the function was disabled in the security settings, this method will not work.

💡

Make sure that the date and time on the device you log in to your account are synchronized with the network to avoid login errors on Xiaomi servers.

Unlocking with Google Find My Device

An alternative that can work on devices with a clean version of Android or older MIUI firmware is Google Find My Device, which was originally designed to find lost smartphones, but also allows you to control access to them. The success of the operation depends on whether the phone was enabled GPS and Internet, as well as logged in to Google account.

Log in to the service's website from any browser and log in to the same Google account that was used on the locked phone. The system will try to locate the device. If the connection is established, several options will appear in the management menu, including a lock or unlock function. In some cases, replacing the old password with a new one through this interface allows you to reset the pattern lock.

It is worth considering that on modern versions of Android 10 and higher, Google is gradually removing the ability to directly unlock the screen through this service in order to improve security. However, for owners of older models such as the Redmi Note 8 or Mi 9, this method can help restore access without losing data. If the unlock option is not available, do not try to use the “clean device” feature, as this will lead to the complete deletion of all files.

MethodWe need the Internet.Risk of data lossProbability of success
Mi CloudYes.No.Tall (on old MIUIs)
Google Find My DeviceYes.No.Medium (depending on the Android version)
Safe Mode modeNo.No.Low (for third-party blockers only)
ADB CommandNo (PC needed)No.Low (debugging required)

💡

The success of remote unlocking depends on pre-setting the synchronization and active Internet connection at the time of locking.

Attempting to log in via Safe Mode

Many users install third-party applications to lock the screen, not realizing that they may conflict with system security settings. If your graphical password was set not by system means, but through a downloaded application, it can be bypassed by running a smartphone in Safe Mode. In this mode, only system services are loaded, and third-party software remains inactive.

To enter this mode on Xiaomi, you usually need to press the power button, and then hold the "Switch off" or "Switch off" option on the screen for a long time until you prompt to go to Safe Mode. Some models require you to press the volume button when you turn on the device. If the system allows you to log into the desktop without asking for a password, you can delete the guilty application through the settings.

⚠️ Note: On the modern versions MIUI Entering into safe mode may also require a graphical key confirmation if the lock is set at the system level, in which case this method will prove useless and the screen will remain inaccessible.

If you managed to get to the desktop, immediately go to Settings → Applications → All apps and find a suspicious screen blocker. After removing it, restart the phone as normal. The system lock, if it was likely to remain, but at least you will eliminate the conflict of programs and can try other methods for system locking.

What to do if Safe Mode does not start?
If the button combinations don’t work, try using them. ADB-team `adb reboot safe_mode`, But for this, the phone must be pre-debugging on USB.

Use of debugging by USB and ADB

For advanced users who have activated the developer mode in advance and enabled USB Debugging, there is a technical way to unblock the device via a computer. This method requires an ADB (Android Debug Bridge) driver installed on the PC and a connected cable. The essence of the method is to send a special command that deletes the file that stores the data about the pattern lock.

The key file in Android is usually located on the path /data/system/gesture.key or /data/system/locksettings.db. Deleting this file through the ADB console causes the system to “forget” the password set, but this operation requires superuser rights (Root) or specific access rights, which are closed by default in the standard firmware.

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

Once the commands are executed, you need to restart the device. If it goes well, the phone will ask for a new password and the old one will be ignored. It is worth noting that on Android 6.0 and higher devices, as well as current versions of MIUI, this method often does not work without root rights due to the increased protection of /data partition. However, on older Redmi models this can be a salvation.

☑️ Checking readiness ADB-method

Done: 0 / 1

Specifics of unlocking different versions of MIUI

The MIUI shell has many modifications, and security behaviors can be drastically different, such as global firmware versions (Global ROM) that allow Mi Cloud unlocking to be more stable than China ROM, which prioritizes local security practices, and that having a month-long security update can close previously known vulnerabilities.

Owners of devices with MIUI 12 and later should be especially careful: it has a more aggressive data encryption policy. Even if you manage to miraculously reset your password through the engineering menu, you may find that the system will require you to enter the old password on the first boot to decrypt user data, this is done to protect information in the event of device theft.

Also worth considering is the processor model. Snapdragon and MediaTek devices can react differently to attempts to interfere with system files. Some MediaTek chipsets have the option of flashing through BROM mode, but this is already a complex procedure that requires special software and often leads to data loss if a full backup is not made.

⚠️ Warning: Attempts to reflash the phone or change system files without a full backup can lead to a "brick state" where the device stops turning on at all%.

What to do categorically not to do when blocking

When trying to get back to the phone, users often do rash things that only make things worse. The most important thing is not to try to guess the password with a pumpkin. After five failed attempts, the system usually blocks the input for 30 seconds, but after 10-15 attempts, the timer may turn on for an hour or more. In some cases, the device may suggest a data reset after a lot of errors.

You can't trust the questionable software on the Internet that promises to hack any phone in five minutes, and most of these tools contain viruses or are fraudulent, and the only thing they can do is force your phone to Recovery mode and perform Factory Reset, which you could do through buttons, but you risk infecting your computer.

Also, avoid rebooting your device frequently in the hope that the “glitch” will pass. Modern Xiaomi smartphones require a password or fingerprint confirmation after a reboot to decrypt the user partition. This is part of the FBE (File Based Encryption) encryption system, and it is impossible to get around it with a simple reboot.

💡

The biggest mistake is repeatedly entering incorrect passwords, which can activate a lock timer or automatic data reset.

Frequently Asked Questions (FAQ)

Can I unlock Xiaomi via Mi Cloud if my phone is turned off?
No, to execute the unlock command, the device must be on and have an active internet connection, and if the phone is turned off, the command will stay in line and execute as soon as the device is turned on and out.
Will resetting the pattern lock erase all photos and contacts?
If you use official methods through Mi Cloud or Google Find My Device with Unblock, the data is saved, but if you use a combination of buttons to log into Recovery and select "Wipe Data", all data will be permanently deleted.
What if the phone says “Device locked” after resetting?
This is Mi Account Lock protection, and you'll need to enter the username and password from the Mi Account that was linked to that phone before the lock, and without that, you'll be unable to use the device because it's anti-theft.
Will the phone help to remove the lock screen?
Official flashing through the Mi Flash Tool in Clean Up mode will delete all data along with the password, but if you have Mi Account binding enabled, after firmware, the phone will still require you to enter a password from the account to activate.
Is there a universal code to unlock all Xiaomi?
No, there are no universal codes. A graphical key or password is stored encrypted in the system partition, and the only way to delete it without losing data is to know it or use synchronized cloud services.