Where to Store Contact File on Xiaomi: A Complete Guide to Search and Backup

Losing contacts on a Xiaomi smartphone is one of the most frustrating situations a user can face. Unlike photos or messages, contacts often don't duplicate automatically in the cloud, and restoring them without a backup turns into a real headache. But what if you know the exact location of the file where the contact database is stored? It not only makes it easier to back up manually, but also allows you to restore data even after a setup is reset or a device breaks.

In this article, we will look at where the contact file on Xiaomi smartphones (including models on MIUI 12/13/14 and HyperOS), how to find it through the file manager or ADB, and consider alternative ways to export and import.

Where to store the contact file on Xiaomi: system paths

The Xiaomi contact file is part of the Android system database, which is managed by the com.android.providers.contacts application. Physically, the data is stored in two formats:

  • ๐Ÿ“ SQLite database โ€“ the main file contacts2.db, containing all contacts, groups and related data (numbers, email, addresses).
  • ๐Ÿ“„ VCard-export โ€“ files with the.vcf extension that are created when manually exported through the contact menu.

The main way to the contact base on Xiaomi (for all versions of MIUI and HyperOS):

/data/data/com.android.providers.contacts/databases/contacts2.db

However, access to this folder is limited: without root rights or ADB, you canโ€™t simply copy a file through a standard file manager.

  • ๐Ÿ”„ /sdcard/MIUI/backup/AllBackup/ โ€” backup MIUI (If Local Backup is enabled).
  • โ˜๏ธ /sdcard/Download/ โ€” vcf files are saved when exported via the contact menu.
  • ๐Ÿ“ฑ /sdcard/DCIM/.thumbnails/ โ€” Sometimes temporary contact files (such as avatars) are cached here.

โš ๏ธ Attention: Direct file editing contacts2.db Without a backup can lead to the loss of all contacts! Android system blocks access to this file while the Contacts app is running, so any manipulations require a preliminary stop of the process.

๐Ÿ“Š How do you usually reserve contacts on Xiaomi?
Through MI Cloud
Export to VCF file
Manual copying of the database
I don't make backups.

How to access a contact file without root rights

If your Xiaomi doesnโ€™t have root access, there are three legal ways to get a contact file:

  1. Export via the contact menu (the easiest method):

Open the Contacts app โ†’ press three points (โ‹ฎ) โ†’ Select Contact Management โ†’ Import/Export of contacts โ†’ Export to file. Contacts.vcf file will be saved in Download folder.

  1. Use of ADB (without root):

Connect your phone to your PC, enable USB Debugging (Settings โ†’ About Phone โ†’ MIUI Version โ†’ 7 times click on version โ†’ Return to Additional Settings โ†’ For Developers) and execute the command:

adb backup -f contacts.ab -apk com.android.providers.contacts

This will back up the contact database in the contacts.ab file on your computer, and you'll need additional software like Android Backup Extractor to retrieve contacts2.db from it.

  1. Backup through MIUI:

Go to Settings โ†’ About Phone โ†’ Backup and Reset โ†’ Local Backup. Select Contacts and create a backup. The file will be saved to /MIUI/backup/AllBackup/ encrypted (.bak extension).

Check the available space on your phone (minimum 50 MB)

Enable USB debugging (if you use ADB)

Make sure your contacts are synchronized with your account MI (setting โ†’ Accounts)

Close all apps that work with contacts (Telegram, WhatsApp, etc.)

-->

Important:.ab and.bak files cannot be opened directly, they require special tools for unpacking. If you want a database of contacts2.db, it is easier to use ADB root-rights or third-party applications like Contact Backup & Restore.

Search for contact files with root rights

If your Xiaomi has Magisk or another root-getting method installed, you can directly copy the contacts2.db file through any root-enabled file manager (such as Root Explorer or Solid Explorer).

  1. Open the file manager and go to /data/data/com.android.providers.contacts/databases/
  2. Find files: contacts2.db - the main database; contacts2.db-shm and contacts2.db-wal - auxiliary files for SQLite.

Copy all three files to a secure location (e.g., on a PC or cloud).

Critical information: All three files (contacts2.db, -shm and -wal) are required to correctly restore contacts; copying only contacts2.db can damage the base when importing.

File.DescriptionCan I copy it separately?
contacts2.dbMain Contact Database (SQLite)โŒ No (support files required)
contacts2.db-shmShared memory to speed up workโŒ No.
contacts2.db-walWrite-Ahead Log for TransactionsโŒ No.
contacts.vcfExported contacts in vCard formatโœ… Yes.

โš ๏ธ Note: When copying database files through root, be sure to stop the process com.android.providers.contacts by command: adb shell am force-stop com.android.providers.contacts Otherwise file contacts2.db It may be blocked for reading.

How to Recover Contacts from a File contacts2.db

If you have a backup of the contacts2.db file (along with -shm and -wal), you can restore contacts in two ways:

Method 1: Through root access

  1. Delete the current database files at /data/data/com.android.providers.contacts/databases/.
  2. Copy backup files (contacts2.db, -shm, -wal) to the same folder.
  3. Change the access rights: chmod 660 /data/data/com.android.providers.contacts/databases/contacts2.db*
  4. Reboot the phone.

Method 2: Through ADB (without root)

If you donโ€™t have root rights, but you have a backup of contacts.ab (created through adb backup), restore it by the team:

adb restore contacts.ab

A request for recovery will appear on the phone - confirm it.

Alternative method: Convert contacts2.db c.vcf using tools such as DB Browser for SQLite (open file, export table) raw_contacts into CSV, then convert to VCF via online services).

๐Ÿ’ก

Before restoring contacts from the backup, check its integrity: open the file contacts2.db in any SQLite browser (such as SQLiteStudio) and make sure that the table is raw_contacts not-empty.

Frequent problems and their solutions

When working with contact files on Xiaomi, users encounter typical errors:

  • ๐Ÿ”’ "No access to the folder. /data/data/" โ†’ Solution: Use ADB Or you get root rights. Standard file managers don't have permission to read system folders.
  • ๐Ÿ—ƒ๏ธ "File. contacts2.db damaged" โ†’ Solution: Restore the database from backup or export contacts to.vcf before resetting your phone.
  • โ˜๏ธ "Contacts are not synchronized with MI Cloud" โ†’ Solution: Check your Mi Account settings (Settings) โ†’ Accounts. โ†’ Mi Account โ†’ Sync) and enable the Contact option.
  • ๐Ÿ“ฑ "Once restored, the contacts are duplicated" โ†’ Solution: Clear current contacts via Settings before recovery โ†’ Annexes โ†’ Contacts โ†’ Warehouse โ†’ Clear the data.

If your contacts are missing after the MIUI update, try:

  1. Roll back the update via Settings โ†’ About Phone โ†’ System Update โ†’ Click on the MIUI logo 10 times โ†’ Select the rollback version.
  2. Restore contacts from MI Cloud (if sync is enabled).
  3. Use data recovery applications such as Dr.Fone or EaseUS MobiSaver (only work without root on newer versions of Android).
What if the contacts2.db file is not in the folder?
If in a folder /data/data/com.android.providers.contacts/databases/ no file contacts2.db, It could mean: 1. Contacts are stored only in the cloud (check out the data). MI Cloud or Google Contacts). 2. There has been a reset and the database has not been recreated (try adding a test contact and checking the folder again). 3. You have custom firmware installed, where the path to the base may differ (for example, /data/user_de/0/com.android.providers.contacts/databases/).

Alternative methods of backup contacts

If manual work with contacts2.db files seems difficult, use alternative methods:

  • โ˜๏ธ MI Cloud: automatically syncs contacts with Xiaomi servers. โ†’ Accounts. โ†’ Mi Account โ†’ Synchronization.
  • ๐Ÿ“ฑ Google Contacts: Add a Google account and enable sync in Settings โ†’ Accounts. โ†’ Google โ†’ Synchronization of the account.
  • ๐Ÿ“ค Third-party apps: Super Backup & Restore - saves contacts in.vcf and on Google Drive. My Contacts Backup - sends backup to email. Contacts Optimizer - cleans duplicates and creates backups.
  • ๐Ÿ’ป PC software: programs like Mobogenie or WonderShare MobileTrans allow you to export contacts to the Internet CSV/Excel.

Cloud services (MI Cloud or Google Contacts) have the advantage of automatic synchronization, but they are not immune to accidental deletion: if you delete a contact on your phone, it will disappear from the cloud, so it is recommended to periodically create local backups in.vcf format.

๐Ÿ’ก

The most reliable way to back up is by combining cloud sync (MI Cloud/Google) and local export to.vcf once a month.

How to Transfer Contacts from One Xiaomi to Another

Transfer contacts between Xiaomi devices can be done in several ways:

Method 1: Through the MI Cloud

  1. On an old phone: Enable contact sync in MI Cloud (Settings โ†’ Accounts โ†’ Mi Account โ†’ Sync).
  2. On a new phone: log in to the same Mi Account and wait for sync.

Method 2: Through the VCF file

  1. On an old phone, export contacts to.vcf (as described above).
  2. Move the file to a new phone (e.g., via Bluetooth, Xender, or the cloud).
  3. On your new phone, import the file: Contacts โ†’ Contact Management โ†’ Import / Export โ†’ Import from the device.

Method 3: Through Google Account

  1. On an old phone, add a Google Account and sync your contacts.
  2. On the new phone, log in to the same Google account โ€“ contacts will be automatically pulled up.

If you have root access on both devices, you can directly copy contacts2.db files from one phone to another, but this method is risky: differences in MIUI versions can lead to database errors.

FAQ: Frequent questions about the contact file on Xiaomi

Can I open the file? contacts2.db computer-based?
Yes, for that, use programs like DB Browser for SQLite or SQLiteStudio. In the file you will find tables raw_contacts (basic data, data (numbers, email) and mimetypes (data types). For convenience, export tables to the following: CSV.
Why are contacts not displayed after recovering from contacts2.db?
Probable reasons: Support files (contacts2.db-shm, contacts2.db-wal) are missing; the MIUI version on the new phone is incompatible with the old base; incorrect file access rights (should be 660); try to restore contacts via.vcf or MI Cloud.
Where do you keep contacts? SIM-maps on Xiaomi?
Contacts SIM-The cards are stored in the cardโ€™s memory and are not displayed in the file. contacts2.db. To export them: Open contact โ†’ SIM-Contacts. Press Control. โ†’ Imports/Exports โ†’ Export to the device. The file will be saved in.vcf format in the Download folder.
How to protect your contacts from accidental deletion?
Recommendations: Enable sync with MI Cloud and Google Contacts at the same time. Create local backups of.vcf every 1-2 months. Use applications with Deletion Protection (such as Contacts+). Store a copy of the contacts2.db file on your PC or cloud drive.
Can I restore remote contacts without backup?
The chances are slim, but try: Check the cart in MI Cloud (available 30 days after deletion). Use data recovery software (Dr.Fone, DiskDigger), but they require root rights on new versions of Android. If contacts were linked to a Google account, check contacts.google.com under the Recycle Bin.