Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract database of an application from android device through adb

How can I extract the database of an application from an android device through an adb shell command?

like image 218
Siddharth_Vyas Avatar asked Feb 18 '23 14:02

Siddharth_Vyas


2 Answers

If you have neither SD card nor root on your device, just use adb shell.

$ adb shell
$ run-as com.your.package cat /data/data/com.your.package/databases/your_db > /storage/sdcard0/Download/your.db

Then use DDMS to pull file out.

like image 137
Aliaksei Avatar answered Apr 06 '23 11:04

Aliaksei


Databases are stored in files, mostly on internal storage, in App's data directory like :

/data/data/com.example.myapp/mydb 

so you can do

adb pull /data/data/com.example.myapp/mydb

Then you can use some software to open that file, and work with data base. To place it back:

adb push <new file> /data/data/com.example.myapp/mydb
like image 45
S.D. Avatar answered Apr 06 '23 12:04

S.D.