Forgot the pattern lock or PIN-code 5A? Do not rush to carry it to the service center - in 80% of cases, you can unlock yourself through a computer. This guide will work even if you donβt have access to your Mi Account, and your phone asks for confirmation after resetting your settings.
We'll look at three working methods: official Mi Unlock Tool (to unlock the bootloader), Fastboot reset, and alternative ADB. Each option has its own nuances, from waiting 72 hours to the risk of data loss. Importantly, if the phone has Find Device enabled, some methods may not work without first disabling this option.
Before you start, check:
- π Redmi battery level 5A β If you discharge during the procedure, the phone can turn into a brick".
- π» The computer has Qualcomm drivers installed and ADB/Fastboot (References to downloads - in the relevant sections).
- π₯ The original is at hand. USB-cable (do not use cheap Chinese analogues - they often cause connection errors).
Preparation of the computer: drivers and programs
Without properly installed drivers, your computer simply wonβt see your Redmi 5A in Fastboot or EDL modes. Letβs start with the most important thing β installing the Mi USB Driver and the ADB/Fastboot package.
For Windows 10/11, download the official driver from Xiaomi:
- π Download page Mi Unlock Tool (at the bottom of the page there is a link to drivers).
- π Unpack the archive and run DriverInstall.exe on behalf of the administrator.
- π After installation, restart your computer β it is a must!
Next, install Minimal ADB and Fastboot (lightweight version, no unnecessary components):
- Download the tool with XDA Developers.
- Start the installer and follow the instructions (the installation path is best left by default: C:\Program Files (x86)\Minimal ADB and Fastboot).
- After installation, open the Command Prompt in the utility folder (click Shift + right mouse button β βOpen PowerShell window hereβ).
β οΈ Note: If you have an Avast or Kaspersky antivirus, temporarily disable it while you install drivers.These programs often block Xiaomi files, considering them suspicious.
Check the phone's connection:
- Turn off Redmi 5A.
- Press Volume Down + Power before the Fastboot logo appears.
- Connect your phone to your PC and type in the command line: fastboot devices If in response you saw the serial number of the device - the drivers are installed correctly.
2. Official method: Mi Unlock Tool (to unlock the bootloader)
This method is suitable if you want to unlock the bootloader for later firmware or if the phone is locked due to binding to the Mi Account. Note: Xiaomi has introduced a restriction - after linking the account to the device, you need to wait 72 hours before unlocking.
Step-by-step:
- Download Mi Unlock Tool from the official website (version must be at least 5.5.224.24).
- Unpack the archive and launch it. miflash_unlock.exe on behalf of the administrator.
- Sign in to your Mi Account (if you forgot your password, restore it in advance!).
- Connect your phone in Fastboot mode (as in the previous section).
- Press Unlock and confirm the action.
If you see a "Couldn't unlock" or "Current account is different from the one bound to this device" error, you will see:
- π You didnβt wait 72 hours after you linked your account.
- π± The phone was bought with hands and tied to someone elseβs account (the solution is to contact the previous owner or use alternative methods).
- π You are trying to unlock your phone from a region other than where it was activated (e.g., a phone for China will be unlocked in Russia).
β οΈ Note: Once the bootloader is unlocked, all data, including photos and apps, will be deleted from the phone. If you want to save information, try the method first with the help of the bootloader. ADB (section).
Battery level of charge > 50%|Drivers are installed and the phone is determined in Fastboot|Mi Account tied to phone more than 72 hours ago|Disabled antivirus that blocks the work of the utility|Used by the original USB-cable-->
3.Reset via Fastboot: Completely clean the phone
If you don't have to save data, and the main goal is to just remove the lock, this is the fastest method. It works even if you don't remember the data from the Mi Account, but the phone should support Fastboot mode.
Instructions:
- Connect Redmi 5A to your computer in Fastboot mode (clip Volume Down + Power).
- Open the command line in the folder with ADB and enter alternately: fastboot flashing unlock fastboot flashing unlock_critical fastboot erase userdata fastboot erase frp fastboot reboot
- After the reboot, the phone will be like after the purchase - without a password and binding to the account.
If the fastboot flashing unlock command doesnβt work, try an alternative:
fastboot oem unlock
fastboot erase userdata
fastboot erase frp
fastboot rebootPossible errors and solutions:
| Mistake. | Reason. | Decision |
|---|---|---|
| FAILED (remote: unknown command) | An outdated version of Fastboot | Update ADB to the latest version or use MiFlash |
| device not found | Drivers are not installed or the cable is faulty | Check the connection, try another USB port |
| This device is locked | bootloader locked | Use the Mi Unlock Tool (Section 2) |
| erase not allowed | Anti-Rollback protection included | Swipe your phone through EDL (Section 5) |
π‘
If after resetting the phone, again asks to enter the old password, then the lock was tied to the Google account (FRP), in this case, after the command fastboot erase frp, you need to additionally perform fastboot erase config and reboot.
4.Alternative method: Unlocking through ADB (without data loss)
This is the only way to save data on your phone if you forget the pattern lock, but remember the Mi Account password or you have USB debugging enabled. The method only works if the phone has previously activated the USB debugging option in the developer settings.
How to check if the debugging is included:
- π§ Go to Settings. β The phone. β Version. MIUI and tap 7 times on this item to activate the developer mode.
- π Back to Settings β Additionally. β For developers and find the Debugging item USB.
- π If the option is active, you can start unlocking.
Instructions for unlocking:
- Connect your phone to your computer (on!).
- Open the command line and type in: 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
- After the reboot, the screen lock will be reset.
If the su command doesnβt work (no root rights), try to do without it:
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β οΈ Note: Some of the Redmi firmware 5A (for example, MIUI 12 and later) this method may not work due to the increased protection, in which case only a Fastboot reset or EDL.
What if the ADB canβt see the device?
5.Extreme method: Firmware through EDL (for experienced)
If all previous methods failed, the EDL (Emergency Download Mode) mode remains, which requires a special cable or short circuit of the contacts on the board, so it is only suitable for advanced users. Wrong actions can permanently bring the phone down!
What you need:
- π₯ Firmware for Redmi 5A (Download the Xiaomi Firmware Updater).
- π§ MiFlash program (official firmware utility).
- π EDL-cable or ability to close test points on board.
Step-by-step:
- Install MiFlash and unpack the firmware into a folder without Cyrillic characters.
- Turn off the phone and put it in mode. EDL: Method 1: Use it. EDL-cable (connect it to the phone and USB-Port of Port. 2: Take the phone apart, find the points on the board EDL (usually signed and close them with tweezers on 2-3 seconds.
MiFlash
Select
Connect the phone β if the drivers are installed correctly, the program will determine it.
Clean all
Flash
It takes 5-10 minutes. Once it's done, it'll restart in a factory state. If the firmware is successful, but the phone doesn't turn on, try:
- π Repeat the firmware with the choice of Clean all and lock mode.
- π₯ Download a different firmware version (e.g. Global Stable instead of China Stable).
- π§ Check the battery contacts β sometimes they leave after disassembly.
π‘
Firmware through EDL is the most reliable way to unlock, but also the riskiest. If you don't have experience with a soldering iron or test points, you'd better go to a service center.
6. Frequent errors and their solutions
Even if you follow the instructions accurately, you can get errors, and we've collected some of the most common problems and ways to fix them.
Error 1: "This device is locked" in Fastboot
- π Solution: Unlock the bootloader through the Mi Unlock Tool (Section 2).
- β³ If you donβt have time to wait 72 hours, try flashing your phone through the phone. EDL (section).
Error 2: Phone is not defined in Fastboot or ADB
- π Check the cable and port USB (Better to use back ports on PC).
- π₯οΈ Reinstall drivers manually through Device Manager.
- π Try another computer (sometimes drivers conflict).
Error 3: After resetting, the phone asks for an old one PIN-code
- π That means the defense worked. FRP (Factory Reset Protection).
- π± Enter the data from the last Google account that was on your phone.
- π« If you donβt remember the data, run the phone through the EDL Completely erased (Clean all).
Error 4: "Anti-Rollback check fail"
- π This means you are trying to re-shoot an older version. MIUI, more than the one that was established.
- π₯ Download the firmware of the same or newer version.
- π§ If you need the old version, disable the Anti-Rollback check through the modified Fastboot (requires root rights).
7.How to avoid blocking in the future
To avoid having to deal with the problem of a locked phone again, follow these tips:
- π Use fingerprint or facial recognition as your primary method of unlocking them β theyβre more reliable. PIN-code.
- π Write backup unlock codes (for example, in a notebook or password manager).
- π Link your phone to your Mi Account and enable data synchronization.
- π Make backups regularly through Settings β System system β Backup.
- π« Do not buy phones from your hands without first resetting and decoupling from the account of the previous owner.
If you often forget passwords, set up Smart Lock in Android:
- Go to Settings β Lock and Protection β Smart Lock.
- Add reliable devices (such as home Wi-Fi) or places where your phone will unlock automatically.
- Activate the voice unlock option (if available on your firmware).
π‘
MIUI has a hidden emergency unlock function: if you enter the wrong password 5 times in a row, the button "Forgot your password?" β "Emergency call" β dial # # # # #7378423##. This will only work if the phone does not have an attachment to Mi Account.