Sqlite3 command reads the file contents of the Sqlite3 format case

Source: Internet
Author: User

/********************************************************************* * Author:samson * date:07/09/2014 * Test PL Atform: * 3.11.0.11-generic #19-ubuntu * GNU bash, version 4.2.45 * **************************** ***************************************/

SQLite is an Embedded SQL database engine, only with one file on OK, small and convenient, so is a very good embedded database, in Mozilla Firefox using SQLite as a database.


For example: The file that stores the cookie is a SQLite database file, usually exists in the ~/.mozilla/firefox/cojs83dh.default directory, then how to view it?

You can use VIM to open the file, see the format used is sqlite3, and under GNU Linux there is a command to view it: Sqlite3, the following is the specific use of the steps:

0. Use the command to open this database:
$ sqlite3 Cookies.sqlite
Enter the Sqlite3 command line mode;

1. View the names of the databases in this file:
sqlite>. Databases
Seq Name file
---  ---------------  ----------------------------------------------------------
0 Main/home/ufo/.mozilla/firefox/cojs83dh.default/cookies.sqlite

2. Then check that the data table already exists in this file:
Sqlite>. Tables
Moz_cookies
You can see that this file contains a table named Moz_cookies;

3. View the field names in this table:
sqlite>. Schema moz_cookies
CREATE TABLE moz_cookies (id integer PRIMARY KEY, Basedomain TEXT, appId integer DEFAULT 0, inbrowserelement integer defau LT 0, Name text, value text, host TEXT, path text, expiry integer, lastaccessed integer, CreationTime integer, issecure in Teger, Ishttponly INTEGER, CONSTRAINT moz_uniqueid UNIQUE (name, host, Path, AppId, inbrowserelement));
CREATE INDEX Moz_basedomain on Moz_cookies (Basedomain, AppId, inbrowserelement);

4. Display the data entry in the table:
sqlite>. Mode Line
The above sentence indicates that the display mode of the output table item is displayed for each field in a row;
The following statement outputs a table item entry that resembles the following:
Sqlite> select * from Moz_cookies;
ID = 10
Basedomain = bing.com
AppId = 0
inbrowserelement = 0
Name = Srchuid
Value = v=2&guid=ac1bddf445c84528931cf2960245b9a9
Host = cn.bing.com
Path =/
Expiry = 1466758101
lastaccessed = 1404991858781769
CreationTime = 1403686100491716
Issecure = 0
ishttponly = 0

ID = 11
Basedomain = bing.com
AppId = 0
inbrowserelement = 0
Name = Srchusr
Value = autoredir=0&geovar=&dob=20140624
Host =. Bing.com
Path =/
Expiry = 1466758101
lastaccessed = 1404991858781769
CreationTime = 1403686100493026
Issecure = 0
ishttponly = 0

Refer
Http://sqlite.org/about.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.