Where on Xiaomi are stored phone book contacts: the path to the system folder and access methods

Have you ever wondered where all your contacts are physically stored on a Xiaomi smartphone? Unlike photos or documents that can be easily found in a gallery or file manager, the phone book is hidden deep in Android system folders. This is no wonder: contacts are critical data, and the operating system protects them from accidental deletion or change.

On Xiaomi devices with shell MIUI The path to a contact folder may be different from a pure Android, and access to it often requires additional rights. In this article, we will not only show the exact path to the contact database file, but also explain how to safely export, edit or restore it. You will learn why standard backup methods through Settings β†’ Google β†’ Backups aren’t always reliable, and what to do if contacts suddenly disappear after an update MIUI.

It’s important to understand that working with system contact files requires caution. One wrong action can lead to the loss of all phone book entries, so we’ll take a detailed look at every step from obtaining root rights (if necessary) to using alternative backup methods through Mi Account or third-party apps.

Where exactly are your contacts stored on Xiaomi: the way to the system database

All Xiaomi smartphones (including Redmi models, POCO and Black Shark phone book contacts are stored in the SQLite database with the name contacts2.db. This file is located in a secure system folder, access to which is limited even for a user with developer rights.

The exact path to the file:

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

What is important to know about this path:

  • πŸ“ folder /data/data/ β€” This is an isolated application store. Each application has a directory with a unique identifier (in this case, com.android.providers.contacts).
  • πŸ”’ Access to this folder is possible only with root rights or through ADB (Android Debug Bridge with enabled debugging USB.
  • πŸ“± On some firmware MIUI (The Chinese version may be slightly different, but contacts2.db The file may be called contacts.db or be in a subfolder. /databases/.
  • πŸ”„ If you use a Google account to sync, the contacts are additionally duplicated in the cloud, but the local copy is still stored in that file.

A critical nuance for Xiaomi: starting with MIUI 12, The system uses folder virtualization, so even with root rights, the path can be displayed as a symbolic link. /data/user_de/0/com.android.providers.contacts/databases/.

πŸ“Š How do you usually reserve your contacts?
Through Google Account
Through the Mi Account.
I'm manually exporting it to a file.
I use third-party apps.
I don't make backups.

How to access the folder with contacts: 3 working methods

Access to the file contacts2.db It requires you to bypass the limitations of Android, and let's look at all the different ways that we can do it, from the simplest to the most complex.

1. Through ADB (rootless)

If your Xiaomi has enabled debugging on USB, You can copy the contact file through ADB:

adb pull /data/data/com.android.providers.contacts/databases/contacts2.db C:\backup\

However, this method does not work on all versions. MIUI β€” Since Android 11, Google has tightened the rules for accessing app data.

2. Through root rights

If you have Magisk or another root access manager installed, use any root-enabled file manager (such as Root Explorer or Solid Explorer).

Attention: when copying a database file contacts2.db Please stop the process of com.android.providers.contacts through ADB Task Manager or the file may be damaged.

3. Through backup MIUI

The safest way is to use the built-in backup function MIUI:

  1. Go to Settings β†’ About Phone β†’ Backup and Reset β†’ Local Backup.
  2. Select Contacts and create a backup.
  3. The backup file will be saved to /MIUI/backup/AllBackup/.

This file has the.bak extension and contains encrypted data, but it can be restored through the same settings section.

Check the available space on the device (minimum 50 MB)

Enable debugging over USB in the developer settings

Make sure the battery is more than 50% charged.

Turn off sync with Google for copy time (optional)-->

File structure contacts2.db: What's inside the contact database

File. contacts2.db β€” It's a SQLite database that contains several tables:

Title of the tableDescriptionKey fields
raw_contactsProvides basic information about each contact (ID, name, account)_id, display_name, account_name, account_type
dataStores all contact details (phone numbers, email, addresses)raw_contact_id, mimetype, data1, data2
phone_lookupIndex for quick search by phone numbernormalized_number, raw_contact_id
groupsInformation on contact groups_id, title, account_name

To view the contents of the database, you can use programs like DB Browser for SQLite or SQLiteStudio. However, editing the file directly is not recommended - this can lead to data corruption.

If you need to extract contacts in a readable format, it is better to export them through standard Android tools:

  1. Open the Contacts app.
  2. Click on three dots in the upper right corner β†’ "Contact management" β†’ "Imports/Exports".
  3. Select Export to File and specify the format (usually.vcf).

πŸ’‘

If you often work with a contact database, create a separate account in the Contacts app specifically for test manipulations, which will avoid losing real data during experiments.

What to do if contacts are lost: recovery from the system folder

If the contact is Suddenly disappeared after a MIUI update or factory reset, you can try restoring them from the system folder. Here’s how:

Option 1: Restore from a local MIUI backup

  • πŸ“± Go to Settings β†’ About phone β†’ Backup & reset β†’ Local backups.
  • πŸ” Select the backup file containing contacts (check the creation date).
  • πŸ”„ Tap "Restore" and confirm the action.

Option 2: Manual recovery via ADB (if you have a backup of contacts2.db)

adb push C:\backup\contacts2.db /data/data/com.android.providers.contacts/databases/


adb shell chmod 660 /data/data/com.android.providers.contacts/databases/contacts2.db




adb shell chown system:system /data/data/com.android.providers.contacts/databases/contacts2.db




adb shell restart

Option 3: Using Mi Account synchronization

If you previously enabled synchronization with Mi Account:

  1. Go to Settings β†’ Mi Account.
  2. Check if the "Contacts" toggle is enabled.
  3. Tap "Sync now" and wait for the process to complete.

⚠️ Attention: If contacts disappeared after a MIUI update, do not create new contacts before recovery! The system may overwrite the old database with a new one, making recovery impossible.

Why contacts might disappear after a MIUI update
During major updates (e.g., from MIUI 12 to MIUI 13), the system sometimes resets the contacts database if it detects inconsistencies. This is a known issue, especially on devices with customized Chinese ROMs. The problem is compounded if the user has disabled synchronization with Google or Mi Account.

Alternative ways to back up contacts on Xiaomi (without root)

If you don’t want to deal with system folders, there are simpler and safer ways to back up your contacts:

1. Export to VCF file

The standard Android method:

  1. Open the "Contacts" app.
  2. Tap the three dots β†’ "Manage contacts" β†’ "Import/Export".
  3. Select "Export to storage" and choose the .vcf format.
  4. The file will be saved in the root of internal storage (usually named contacts.vcf).

2. Synchronization with Google

The most reliable method:

  • πŸ”— Go to Settings β†’ Accounts β†’ Google.
  • πŸ”„ Enable synchronization for "Contacts".
  • πŸ“± All contacts will be uploaded to your Google account and can be restored on any device.

3. Third-party apps

Popular apps for backing up contacts:

  • πŸ“² Super Backup & Restore β€” allows backing up contacts, messages, and apps.
  • πŸ“± My Contacts Backup β€” exports contacts to VCF or email.
  • ☁️ Contacts+ β€” syncs with cloud services and creates backups.

Important: If you use third-party apps, check their permissions in Settings β†’ Apps β†’ Permissions to ensure they have access to contacts.

πŸ’‘

The safest backup method is combining Google synchronization with a local VCF export. This ensures you have both a cloud copy and a physical file.

Frequently asked questions about contacts on Xiaomi

Here are answers to the most common questions about working with the phonebook on Xiaomi devices:

Why don’t contacts sync with Google on my Xiaomi?
Possible reasons: πŸ”• Synchronization is disabled in Settings β†’ Accounts β†’ Google. πŸ“΅ The device has no internet connection. πŸ”„ The MIUI optimization feature is blocking background sync (disable in Settings β†’ Battery β†’ App battery saver). πŸ“± The contacts are saved to the phone’s memory, not the Google account (check in the Contacts app under "Manage contacts β†’ Default save location").
How to transfer contacts from Xiaomi to iPhone?
Instructions: On Xiaomi, export contacts to a .vcf file (as described above). Send the file to your email or cloud storage (Google Drive, iCloud). On the iPhone, open the file β€” iOS will automatically add the contacts to the phonebook. Alternatively, sync contacts with Google on Xiaomi, then add the same account to the iPhone.
Can I edit the contacts2.db file directly?
Technically yes, but it’s highly discouraged. The contacts2.db file has a complex structure with multiple linked tables. Even a small error can corrupt the entire database. If you need to edit contacts in bulk, use specialized apps like Contacts Editor or export to VCF, edit in Excel, and re-import.
Where are contacts stored if I use Dual Apps on Xiaomi?
When using Dual Apps (for example, a second WhatsApp), contacts for the cloned app are stored in a separate database: /data/data/com.android.providers.contacts.{random_number}/databases/contacts2.db To access them, you’ll need root rights and to know the exact package name of the cloned app.
How to recover contacts after a factory reset without a backup?
If you didn’t create a backup, try these methods: πŸ” Check if synchronization with Mi Account or Google was enabled before the reset. πŸ“± Use data recovery apps like Dr.Fone or EaseUS MobiSaver (success depends on whether the data was overwritten). πŸ’Ύ If the device was rooted before the reset, the contacts2.db file might still be recoverable using ADB or disk recovery tools. Note: The chances of recovery are highest if you act immediately after the reset. Every new action on the device reduces the likelihood of successful recovery.

Security recommendations when working with the contacts database

Working with system files always carries risks. Follow these rules to avoid data loss:

  • πŸ” Always create a backup before any manipulations with contacts2.db. Even viewing the file can sometimes lead to corruption.
  • πŸ›‘οΈ Use reliable file managers with root support (e.g., FX File Explorer or Solid Explorer). Avoid unknown apps from unofficial sources.
  • πŸ”„ If you’re editing the database, do it on a copy of the file, not the original.
  • πŸ“΅ Disable automatic synchronization with Google or Mi Account while working with the database to avoid conflicts.
  • πŸ”§ After manual changes, restart the device to ensure the system correctly reloads the contacts.

⚠️ Attention: On devices with MIUI 14+, Xiaomi introduced additional protection for system files. Attempting to modify contacts2.db without proper permissions may trigger the anti-tampering mechanism, leading to a bootloop. If you’re not experienced with ADB and root, it’s better to use standard backup methods.

If you regularly work with large contact databases (e.g., for business), consider using CRM systems like HubSpot or Zoho, which offer more reliable synchronization and backup tools than standard Android features.

Conclusion: What’s the best way to manage contacts on Xiaomi?

While knowing the location of the contacts database (/data/data/com.android.providers.contacts/databases/contacts2.db) can be useful in extreme cases, for most users, standard methods are sufficient:

  • πŸ”„ Regular synchronization with Google or Mi Account β€” the simplest and most reliable way.
  • πŸ“„ Periodic export to VCF β€” creates a physical copy that can be stored on a computer or cloud.
  • πŸ“± Using third-party apps for advanced features (merging duplicates, bulk editing).

Accessing the system folder is only necessary in exceptional cases β€” for example, when recovering data after a failed update or if standard methods don’t work. Remember that Xiaomi regularly updates the security mechanisms in MIUI, so manual methods may stop working with new versions of the firmware.

If you’ve lost contacts and none of the methods helped, contact Xiaomi Support with a detailed description of the problem. In some cases, they can restore data from server backups (if synchronization was enabled).