TechBuzzPro

Where Are Texts Stored on Android – Location Guide

· 5 min read · Phones & Tablets

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, Android stores text messages in a SQLite database file located in the internal data folder of the Messages app, typically under /data/data/com.android.providers.telephony/databases/mmssms.db. The file is not accessible to regular apps without root, but you can view or back it up using a file‑explorer with root privileges or the Android Debug Bridge (ADB) on a computer.

What You'll Need

  • A computer with ADB installed (available from the Android developer site)
  • A USB cable to connect your Android device to the computer
  • USB debugging enabled on the phone (Settings > About phone > Tap Build number seven times, then Settings > System > Developer options > USB debugging)
  • Root access on the device, or a file‑explorer app that can request root (e.g., Solid Explorer, MiXplorer) if you prefer to work directly on the phone
  • Optional: a SQLite viewer on the computer (DB Browser for SQLite is free)

Step-by-Step

  1. Enable developer options and USB debugging on your Android device. Open Settings, scroll to About phone, tap Build number seven times, then return to System → Developer options and toggle USB debugging on.
  2. Connect the phone to your computer via USB. When prompted on the device, allow the computer to access the phone for debugging.
  3. Open a command prompt (Windows) or terminal (macOS/Linux) on the computer and verify the connection by typing adb devices. Your device’s serial number should appear under “list of devices attached”.
  4. If your device is not rooted, you will need to pull the database using the run-as command, which works only for debug builds of the app. Most production devices require root. Assuming you have root, first gain a root shell: adb root. If the command returns “adbd is already running as root”, you can continue.
  5. Navigate to the messages database directory and copy the file to a temporary location you can access. Run:
    adb shell "cp /data/data/com.android.providers.telephony/databases/mmssms.db /sdcard/"
    This copies the database to the shared storage area (/sdcard), which is readable without root.
  6. Pull the file from the device to your computer:
    adb pull /sdcard/mmssms.db ./mmssms.db
    The file mmssms.db now resides in the current folder on your PC.
  7. Open the database with a SQLite viewer. You will see tables such as sms and mms. The sms table contains columns for address, date, body, type, and read status, which represent each text message.
  8. If you prefer to view messages directly on the phone, install a root‑capable file explorer, navigate to /data/data/com.android.providers.telephony/databases/, and copy mmssms.db to a folder on internal storage. Then use a SQLite viewer app (e.g., SQLite Editor) to open the file.
  9. To back up the messages for later restoration, keep the copied mmssms.db in a safe location. Restoring involves pushing the file back to the same path and setting proper permissions:
    adb push ./mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
    adb shell "chmod 660 /data/data/com.android.providers.telephony/databases/mmssms.db"
    adb shell "chown system:system /data/data/com.android.providers.telephony/databases/mmssms.db"
    After pushing, reboot the device to let the Messages app reload the database.

Common Mistakes

  • Skipping root access: Without root, the /data/data directory is locked down. Attempting to copy the file will fail with “Permission denied”. Use a rooted device or a backup method that extracts the database via the system backup API.
  • Using the wrong package name: Some manufacturers bundle the messaging app under a different package (e.g., com.samsung.android.messaging). Verify the exact package name with adb shell pm list packages | grep messaging before navigating.
  • Overwriting the database: Restoring an older mmssms.db without matching the schema can cause the Messages app to crash. Always back up the current database before overwriting.
  • Not resetting permissions: After pushing a new file, failing to set the correct owner (system) and mode (660) will prevent the app from reading it.

Tips

  • Use adb backup -apk -shared -all -f backup.ab to create a full device backup that includes the messages database, then extract the .ab file with android-backup-extractor if you need a quick snapshot without rooting.
  • For devices with Android 10+ that enforce scoped storage, copying to /sdcard still works because the path is part of shared storage. However, you may need to grant the file‑explorer “All files access” permission in Settings > Apps > Special app access.
  • If you only need a human‑readable export, use the built‑in “Export chat” feature in the Messages app (if available) to generate an XML or CSV file, which avoids dealing with the raw database.
  • When inspecting the database, filter by the type column (1 = received, 2 = sent) to separate inbound and outbound texts.

Troubleshooting

  • Device not listed after adb devices: Ensure the USB cable supports data transfer, enable “File transfer” mode on the phone, and reinstall the Android USB driver on Windows.
  • “Permission denied” when copying the file: Verify you have root. On some devices, adb root is disabled in production builds. In that case, you must flash a custom recovery (e.g., TWRP) and use its file manager to pull the database, or use a third‑party backup app that runs with root.
  • Database appears empty in SQLite viewer: The Messages app may be using a different database file (e.g., mmssms.db-wal and mmssms.db-shm for write‑ahead logging). Copy those files alongside mmssms.db before opening; the viewer will automatically combine them.
  • App crashes after restoring: Re‑apply correct permissions (system:system, mode 660) and reboot. If the crash persists, delete the restored file and restore the backup you made before the replacement.
  • Unable to locate the database: Some OEM skins store messages in a different provider. Run adb shell "find /data/data -name '*mmssms*'" to search for any matching files.

Frequently Asked Questions

Can I view my texts without rooting the phone?

Only through the official Messages app’s export feature or by using a backup method that leverages Android’s built‑in backup API. Direct access to mmssms.db requires root.

Where are iMessage or WhatsApp chats stored?

iMessage does not exist on Android. WhatsApp stores its chats in /data/data/com.whatsapp/files/msgstore.db.crypt12, which also requires root to access.

Is the messages database encrypted?

On most stock Android builds the mmssms.db file is not encrypted, but it is protected by file‑system permissions. OEMs may add encryption on devices that enforce file‑based encryption.

Will copying the database affect my carrier’s backup?

No. The carrier’s backup (e.g., Google Backup) stores its own copy of the SMS database in the cloud. Manipulating the local file does not interfere with that service.

Can I import the database into a new phone?

Yes, after copying the database to the new device’s /data/data/com.android.providers.telephony/databases/ path and setting proper permissions, the Messages app will read the old messages.

What if my device is not rooted and I cannot use ADB?

You can use third‑party backup apps that run with the device’s built‑in backup service (e.g., Google Drive backup) to restore messages, but you won’t have direct file access.