How to unlock Xiaomi if you forget your graphical password

The situation when the screen of the smartphone turns into a useless piece of glass due to a forgotten access code, familiar to many owners of Xiaomi equipment. Modern shells MIUI and HyperOS offer a high level of protection, which often becomes a double-edged sword: the system reliably protects your data, but the owner can be left behind if the memory fails at the wrong time. Owners often look for ways to unlock the Xiaomi phone graphical password, without resorting to radical methods like a complete reset.

There are several proven methods of access recovery, the effectiveness of which depends on the version of the operating system, the presence of a linked Mi Account and debugging functions enabled in advance. It is important to understand that data security is a priority, so some methods can lead to a complete cleanup of the device memory. However, if you carefully read the instructions during the initial setup, the chances of returning access to the system without losing photos and contacts are significantly increased.

In this article, we will take a look at all the current ways to bypass locks, from regular restore tools to engineering menus. We will not use third-party software of dubious origin, but focus on the built-in tools that ensure the safety of your gadget.

Staff reset via Mi-account

The most civilized and safe way to restore access to the device is to use the “Forgot Password” function, which is built directly into the pattern lock input interface. This method only works if the smartphone is connected to the Internet (via Wi-Fi or mobile network) and the Mi Account is authorized. After five failed attempts to enter the key, a timer usually appears on the screen, but a button or link “Forgot the password” may also appear.

Clicking on this link, the system will redirect you to the authorization page of Xiaomi servers. You will need to enter a login and password from your account. If the data is entered correctly, the system will prompt you to reset the current pattern lock or digital pin code. This is a regular mechanism that does not require connection to the computer and does not entail the deletion of user files.

⚠️ Note: If you have recently changed your Mi Account password, wait 72 hours before trying to unlock.Security may temporarily block the login from new credentials to protect against hacking.

Importantly, on newer versions of Android (starting with 11 and up) and fresher HyperOS shells, Google and Xiaomi have stepped up security measures, and even with an account, the system can now require confirmation through a previously used graphical key or biometrics if it has been a long time since the last successful unlock, in which case this method may not be available and workarounds will have to be found.

💡

The presence of an active Internet connection and knowledge of the password from the Mi-account are the main conditions for successful unlocking by the standard method without losing data.

Delete the key file via Recovery Mode

If you can't access your account, you can try to delete the system file that stores the hash of your graphical password, which works on devices that have an unlocked bootloader or older versions of Android that don't have overwrite protection on. You need to get into Recovery mode. Turn off your smartphone completely, and then press the volume button and power button at the same time.

When the device vibrates and the Mi logo appears, release the power button, but keep the volume up until the main recover menu appears. Navigation is done with volume buttons (up/down), and the choice is confirmed by the power button. You need to find Wipe Data or Clear User Data. Be careful: in some versions of firmware, this item immediately warns you of complete deletion of data.

However, there is a caveat: Recovery menus are often limited on global firmware versions, and a simple choice of Wipe Data will lead to Factory Reset. We need access to the file system. If there is a Connect with MIAssistant on the menu, connect the phone to a PC. If the menu is minimal, this method may not work without an unlocked bootloader. In this case, the attempt to write a gesture.key or password.key file via ADB may be blocked by access rights.

Technical details of working with keys
Key files are stored in /data/system/. For older versions of Android, just delete gesture.key and the system will assume that there is no password. Newer versions of Android use a more complex hashing system, and simply deleting the file can lead to a cyclic reboot if locksettings.db files are not also cleared.

If you still decide to act through the ADB console (assuming that debugging over USB was enabled earlier), the command will look like this:

adb shell rm /data/system/gesture.key


adb shell rm /data/system/locksettings.db

Once you've done the commands, you need to restart the device, and if it's successful, the phone will let you on the desktop without asking for a password, but if you see an access error message or the phone goes into reboot, then the /data partition is protected, and this method won't work.

📊 What problem are you facing?
Forgot the pattern lock
Forgot my Mi-account password
Phone locked after reset
Another problem.

Resetting settings via Recovery (Hard Reset)

When the sparing methods are exhausted, the most reliable, but radical way is to completely reset the settings to the factory (Hard Reset), this action is guaranteed to remove the lock screen, but delete all user data: photos, contacts, messages and installed applications. Before starting the procedure, make sure that the battery is at least 50%, so that the phone does not turn off at a critical moment.

The process of entering the recovery mode is similar to the one described above: press Volume Up + Power on the device turned off. From the Recovery menu, select the language (usually available in English and Chinese), then go to the Wipe Data section. Then select Wipe All Data and confirm the action by selecting Confirm.

The formatting process can take 2 to 10 minutes depending on the amount of internal memory. Once completed, the message “Data wiped successfully” will appear on the screen. Click Back to Main Menu, then Reboot -> Reboot to System. The first on-line after the reset will be long, as the system creates new configuration files.

☑️ Checklist before resetting

Done: 0 / 4

⚠️ Note: After resetting, the system will require you to enter a password from a Google account or Mi Account that was synced to the device before blocking (FRP). If you don’t remember these passwords, unlocking your phone will be extremely difficult.

Find My Device from Google

Another option that is often overlooked is remote control of the device through Google services, which is relevant if the phone has been turned on, geolocated, and logged in to a Google account, a method that allows not only location tracking, but also remote data cleaning, which effectively removes the screen lock.

You'll need a computer or other smartphone to do this. Go to android.com/find and log in to the same Google account that you use on a blocked Xiaomi. From the device list, select which you want. From the management menu, select the option to Clean the device (Erase Device).

Once the command is confirmed, the phone will receive a reset signal. It's important that the device is online at the time the command is sent. If the phone is off or has no access to the network, the command will run automatically as soon as it appears on the network. This is a great way if you don't remember the passwords from the Mi Account, but remember the data from Google.

Unlocking through USB debugging (ADB)

This method is for advanced users and requires prior training. USB (USB Debugging) is in the Developer menu, and you've previously connected that PC to your phone, allowing access, and the chances of success are high. You'll need to install drivers. ADB Minimal ADB and Fastboot on the computer.

Connect your phone to your PC via the original cable. Open the Command Prompt (CMD) or PowerShell in the ADB tool folder. Enter a command to check the connection:

adb devices

If you have a device that has been listed, you've got a connection, and now you can try to delete the lock files, as mentioned in the Recovery section, but you don't have to go into recovery mode.

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

After all four commands, restart your phone with adb reboot. If the procedure is successful, the phone may ask you to enter a password when you turn on, but any set of characters will fit, or the unlock screen will simply disappear. On newer versions of Android, this method works less often due to the increased permissions to access system files.

💡

Use only the original. USB-Cheap cables often only support charging and do not transmit data, which will lead to a connection error. ADB.

Compatibility table of unlocking methods

To make it easier for you to navigate recovery methods, we have prepared a summary table that will help you quickly assess the chances of success depending on your situation and the condition of the device.

MethodConditions requiredData securityDifficulty
Mi-accountInternet, account passwordYes.Low.
Find My DeviceGoogle account, internet, GPSNo (full reset)Low.
ADB (key removal)USB Debugging enabled, trusted PCYes.Tall.
Hard Reset (Recovery)Physical access to buttonsNo (full reset)Medium

As you can see from the table, data retention methods require either knowledge of account passwords or a pre-prepared system (ADB). If neither condition is met, Hard Reset remains the only working option.

Frequently Asked Questions (FAQ)

Can I unlock Xiaomi without losing data if I don’t remember anything?
Unfortunately, if you don't remember the pattern lock, the password from your Mi Account and Google account, and the USB debugging was not enabled, it's almost impossible to unlock your phone without losing data. Current security standards encrypt user data, and the key to this encryption is your screen lock password.
What is FRP and how to get around it after resetting?
FRP (Factory Reset Protection) is reset protection. After Hard Reset, the phone will require you to enter the account that was on it before the reset. Officially, this can only be circumvented by remembering the password. Third-party methods of bypassing FRP often require specific software and may not work on new versions of Android security.
Will Face ID unlock or fingerprint work after reboot?
No. Once the device is fully rebooted (switched off and on), the biometrics (fingerprint, face) do not work for the initial unlock. The system will always require a pattern lock, pin code or password to be entered, and this is done to protect data in case you are tried to unlock by force.
Will the phone help to remove the password?
Fastboot (Volume Down + Power) flashing with clean-up is like Hard Reset. It will delete your password, but it will also delete all your files. Moreover, if the bootloader is locked, you won’t be able to flash custom firmware or recovers, and the official firmware will also require data cleaning during installation.

In conclusion, the best way to protect against such situations is to regularly back up data to the Mi Cloud or Google Photos cloud, and store passwords in a safe place.