# Encrpyt empty Sqlite DB in Command line

**URL:** <https://discuss.zetetic.net/t/encrpyt-empty-sqlite-db-in-command-line/5728>\
**Category:** SQLCipher\
**Created:** [January 11, 2023, 8:10am UTC](https://discuss.zetetic.net/t/encrpyt-empty-sqlite-db-in-command-line/5728 "2023-01-11T08:10:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gnanaprakasam](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@Gnanaprakasam](https://discuss.zetetic.net/u/Gnanaprakasam)\
**Post date:** [January 11, 2023, 8:10am UTC](https://discuss.zetetic.net/t/encrpyt-empty-sqlite-db-in-command-line/5728/1 "2023-01-11T08:10:23Z")

</div>

Hi,  
I am new to Sqlciper, I want to encrpyt the empty sqlite DB through command prompt. what are the steps needed to do that…

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [January 12, 2023, 2:37pm UTC](https://discuss.zetetic.net/t/encrpyt-empty-sqlite-db-in-command-line/5728/2 "2023-01-12T14:37:25Z")

</div>

Hi @Gnanaprakasam,

Thank you for your interest in SQLCipher. If the database file does not exist when you open it on the command line, you will want to perform a key operation on the database file where you provide the password material used for encryption/decryption:

```auto
./sqlcipher demo.db
sqlite> PRAGMA key = 'YourPasswordGoesHere';
sqlite> CREATE TABLE t1(a, b);

```

After that, you can create your schema, provide data and the database file will be encrypted. You may be interested in reviewing our API documentation \[1\] which provide sample SQL commands for various operations.

* * *

1. [SQLCipher API - Zetetic](https://www.zetetic.net/sqlcipher/sqlcipher-api/)

---

<div class="post-metadata">

**Author:** ![Gnanaprakasam](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@Gnanaprakasam](https://discuss.zetetic.net/u/Gnanaprakasam)\
**Post date:** [January 20, 2023, 9:22am UTC](https://discuss.zetetic.net/t/encrpyt-empty-sqlite-db-in-command-line/5728/3 "2023-01-20T09:22:34Z")

</div>

Hi,  
Thanks for reply, It works for me.
