Skip to content

Instantly share code, notes, and snippets.

@gayanvirajith
Last active June 13, 2020 06:54
Show Gist options
  • Save gayanvirajith/3e51ff50a916555542cce171fe4e948a to your computer and use it in GitHub Desktop.
Save gayanvirajith/3e51ff50a916555542cce171fe4e948a to your computer and use it in GitHub Desktop.
Connect to Sqlite3 via Android ADB Shell

Connect to Sqlite3 via ADB Shell

Enter the command adb devices to get the list of your devices: ~/Android/Sdk/platform-tools/adb devices

Connect a shell to your device: ~/Android/Sdk/platform-tools/adb -s emulator-5584 shell

Navigate to the folder containing your db file: cd data/data/<your-package-name>/databases/

Type su if you ran into any permisson issue; just type su to gain root access

Run sqlite3 to connect to your db: sqlite3 vidura.db

SQLite cheatsheet

There are a few steps to see the tables in an SQLite database:

  • List the tables in your database: .tables
  • List how the table looks: .schema tablename
  • Print the entire table: SELECT * FROM tablename;
  • List all of the available SQLite prompt commands: .help

reference: http://stackoverflow.com/questions/28220636/view-sqlite-database-on-device-in-android-studio

@aakashbhusal7
Copy link

i did the same as u mentioned but when i put the command sqlite3 database_name, i get an error "sqlite3 not found".btw i have sqlite installed and it works perfectly outside the adb shell terminal

@NelsonTallest
Copy link

Both su and sqlite3 is not working on my cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment