所有的应用程序本地文件都存放在/data/data/目录下
C:\Users\nicole>adb shell
* daemon not running. starting it now on port 5039 *
* daemon started successfully *
N555J:/ $ su ($只是普通用户,su命令切换到超级用户#)
N555J:/ # cd data/data
N555J:/data/data # ls
查看Media数据库
N555J:/data/data # cd com.android.providers.media
N555J:/data/data/com.android.providers.media # ls
cache code_cache databases files shared_prefs
N555J:/data/data/com.android.providers.media # cd databases
N555J:/data/data/com.android.providers.media/databases # ls
external.db external.db-wal internal.db-shm
external.db-shm internal.db internal.db-wal
查看某个数据库所有表
N555J:/data/data/com.android.providers.media/databases # sqlite3 external.db
SQLite version 3.19.4 2017-08-18 19:28:12
Enter ".help" for usage hints.
sqlite> .table
album_art audio_genres log
album_info audio_genres_map search
albums audio_genres_map_noid searchhelpertitle
android_metadata audio_meta thumbnails
artist_info audio_playlists video
artists audio_playlists_map videothumbnails
artists_albums_map files
audio images
sqlite>
查看表结构
sqlite> pragma table_info(images);
pragma table_info(images);
0|_id|INTEGER|0||0
1|_data|TEXT|0||0
2|_size|INTEGER|0||0
3|_display_name|TEXT|0||0
4|mime_type|TEXT|0||0
5|title|TEXT|0||0
6|date_added|INTEGER|0||0
7|date_modified|INTEGER|0||0
8|description|TEXT|0||0
9|picasa_id|TEXT|0||0
10|isprivate|INTEGER|0||0
11|latitude|DOUBLE|0||0
12|longitude|DOUBLE|0||0
13|datetaken|INTEGER|0||0
14|orientation|INTEGER|0||0
15|mini_thumb_magic|INTEGER|0||0
16|bucket_id|TEXT|0||0
17|bucket_display_name|TEXT|0||0
18|width|INTEGER|0||0
19|height|INTEGER|0||0
20|is_favorite|INTEGER|0||0
21|date_favorited|LONG|0||0
22|datetaken_favorited|LONG|0||0
23|creator_package|TEXT|0||0
切换显示模式
sqlite> .mode line
sqlite> pragma table_info(images);
pragma table_info(images);
cid = 0
name = _id
type = INTEGER
notnull = 0
dflt_value =
pk = 0
cid = 1
name = _data
type = TEXT
notnull = 0
dflt_value =
pk = 0
cid = 2
name = _size
type = INTEGER
notnull = 0
dflt_value =
pk = 0
查询表中的数据
sqlite> select * from images;
_id = 1
_data = /storage/emulated/0/Pictures/Screenshots/Screenshot_2018-05-10-10-27-04.png
_size = 1987030
_display_name = Screenshot_2018-05-10-10-27-04.png
mime_type = image/png
title = Screenshot_2018-05-10-10-27-04.png
date_added = 1525919227
date_modified = 1525919227
description =
picasa_id =
isprivate =
latitude =
longitude =
datetaken = 1525919224704
orientation =
mini_thumb_magic =
bucket_id = 1028075469
bucket_display_name = Screenshots
width = 1080
height = 2160
is_favorite = 0
date_favorited = 1525919227
datetaken_favorited = 1525919227098
creator_package =
查看数据库所有表的建表语句(每个SQLite数据库中都还有一个隐藏的sqlite_master表)
sqlite> select * from sqlite_master;
type = table
name = android_metadata
tbl_name = android_metadata
rootpage = 3
sql = CREATE TABLE android_metadata (locale TEXT)
type = table
name = thumbnails
tbl_name = thumbnails
rootpage = 6
sql = CREATE TABLE thumbnails (_id INTEGER PRIMARY KEY,_data TEXT,image_id INTEGER,kind INTEGER,width INTEGER,height INTEGER)
type = index
name = image_id_index
tbl_name = thumbnails
rootpage = 7
sql = CREATE INDEX image_id_index on thumbnails(image_id)
type = table
name = artists
tbl_name = artists
rootpage = 10
sql = CREATE TABLE artists (artist_id INTEGER PRIMARY KEY,artist_key TEXT NOT NULL UNIQUE,artist TEXT NOT NULL)