Opening database file from within SQLite command-line shell

后端 未结 8 1129
时光说笑
时光说笑 2021-01-29 21:07

I\'m using the SQLite Command Line Shell. As documented, I can open a database by supplying it as an argument to the executable:

sqlite3 data.db

8条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-29 22:13

    The command within the Sqlite shell to open a database is .open

    The syntax is,

    sqlite> .open dbasename.db
    

    If it is a new database that you would like to create and open, it is

    sqlite> .open --new dbasename.db
    

    If the database is existing in a different folder, the path has to be mentioned like this:

    sqlite> .open D:/MainFolder/SubFolder/...database.db
    

    In Windows Command shell, you should use '\' to represent a directory, but in SQLite directories are represented by '/'. If you still prefer to use the Windows notation, you should use an escape sequence for every '\'

提交回复
热议问题