前言
有的时候我们想查看Android的data目录下的数据库,可以导出来然后通过windows下的安装工具进行打开,但这样太麻烦,其实可以通过内置的sqlite3指令直接对数据库进行操作,下面介绍几条简单的指令。(可能需要root权限)
Kernel: v4.4.126
Device: rk3399
Platform Version: Android 7.1
指令
-
打开数据库,进入指令操作窗口。
sqlite3 xx.db -
不进入指令操作窗口直接查看数据库的内容
sqlite3 xx.dp .dump -
进入指令操作窗口遇到…>,怎么退出?
//输入任何一条数据库语句即可退出 例如: .quit; -
如何退出数据库指令操作窗口,回到adb窗口
Ctrl + d -
从carriers表中查出carrier_enabled=1的所有条目
select * from carriers where carrier_enabled=1; -
从carriers表中查出carrier_enabled=1并且numeric='46012’的所有条目
select * from carriers where numeric='46012' and carrier_enabled=1; -
从carriers表中查出carrier_enabled=1并且numeric='46012’的所有条目,并按照_id进行逆序排列
//DESC:逆序,ASC:正序 select * from carriers where numeric='46012' and carrier_enabled=1 Order By _id DESC;
转载请注明出处:http://www.wolfnx.com/2020/03/18/Sqlite3-Command
作者 : wolfnx
邮箱 : wolfnx@outlook.com
邮箱2 : lostnx@gmail.com

本文介绍了在Android设备上使用SQLite3命令行工具的基本方法,包括打开数据库、查询数据及退出操作等,适用于需要快速查阅SQLite3命令的开发者。
3069

被折叠的 条评论
为什么被折叠?



