username & password in sqlite3

流过昼夜 提交于 2019-11-30 17:11:50

No, sqlite3 databases are very lightweight systems. They need no server and all data is stored in one file. A username/password is not supported by the sqlite/sqlite3 package.

In order to achieve simplicity, SQLite has had to sacrifice other characteristics that some people find useful, such as high concurrency, fine-grained access control, a rich set of built-in functions, stored procedures, esoteric SQL language features, XML and/or Java extensions, tera- or peta-byte scalability, and so forth.

(sqlite, when to use)

However, since it's only a file you can encrypt the file with a password to protect your data.

SQLite doesn't have a concept of username/password. It's just a single file based database.

However, on Unix you can protect your database from other users on the same machine by setting the permissions of the database file itself.

e.g. Allow only owner access

chmod 700 /path/to/sqlitedb

If it's used in a simple web application then the web application will provide the control.

SQLite is mainly an embedded database engine, not intended to be used as a multi-user database server that would require usernames and passwords.

You can always encrypt the database file with some user-provided password/-phrase, I guess. But expecting an embedded DBMS to sport full-blown access control is too much.

Carl McDade

The prior answers are only partially true. You can have databases that require authentication but you'll have to compile SQLite separately from PHP.

See the SQLite User Authentication documentation for further information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!