SQLite在Linux下的安裝

來源:互聯網
上載者:User

下載 sqlite-3.3.6.tar.gz
解壓並拷貝至你想要安裝到的目錄下,我選擇的是/usr/local/sqlite-3.3.6
接著在終端裡:
# cd /usr/local/sqlite-3.3.6
# ./configure
# make
# make install
# make doc

make 的時候提示錯誤
../sqlite-3.3.6/src/tclsqlite.c: In function `DbUpdateHandler':
../sqlite-3.3.6/src/tclsqlite.c:333: warning: passing arg 3 of `Tcl_ListObjAppendElement' makes pointer from integer without a cast
……
這個都是tcl 相關的錯誤, 可以先安裝ActiveTcl 以解決. 假如你不需要tcl 支援, 那麼這個錯誤可以這樣避免:
# ./configure --disable-tcl --prefix=/usr/local/sqlite-3.3.6
# make     如果提示沒有可以編譯的檔案,則是第一次make 時已經執行過了,接著下面做就可以了;如果此次是第一次編譯,應該不會再提示出錯了
# make install
# make doc

測試是否安裝成功
# cd /usr/lcoal/sqlite-3.3.6
# ./sqlite3 text.db                         // 這也是進入資料庫的方法

如果安裝成功,會出現下面這樣的資訊
SQLite version 3.3.6
Enter ".help" for instructions
sqlite>
接下來就可以自由操作啦,和在windows 下是一樣的啦。  

二、 SQLite 基本操作

如以下操作:建立表、插入、查詢:

sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values('hello!',10);
sqlite> insert into tbl1 values('goodbye', 20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite>

注意每句SQL 陳述式後一定要有分號 semicolon 。

Special commands to sqlite3 :

sqlite> .help

.databases             List names and files of attached databases
.exit                  Exit this program

.output FILENAME       Send output to FILENAME
.output stdout         Send output to the screen

.tables                List the tables

  • 1
  • 2
  • 3
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.