SQLite keeps a whole database in one file, so a website can use it without a database server. /go/sqlite prepares such a database for a hosted domain. It: It can also remove the registry entry again with the delete action. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Create a database called mydb for example.com
/go/sqlite example.com mydb
The file is created as /home/example.com/sqlite/mydb.db. A PHP site can open it with sqlite:/home/example.com/sqlite/mydb.db.
Arguments
| Position | Argument | Required | Notes |
|---|---|---|---|
| 1 | <domain> |
Yes | The hosted domain. Its account username is looked up from it. |
| 2 | <name> |
Yes | The database name. The file is called <name>.db. Use letters, numbers, _, and - only. |
| 3 | delete |
To remove | Removes the registry entry. Any other value, or none, creates. |
Nothing is checked. The command does not test that the domain is hosted on this server. A misspelled domain creates a new /home/<domain>/sqlite folder. A name or domain with / or .. in it can create files in other places.
Examples
# Create a database
/go/sqlite example.com mydb
# Remove its registry entry (delete is the third argument)
/go/sqlite example.com mydb delete
# Look at the files
ls -l /home/example.com/sqlite
# Open the database and look at its tables
sqlite3 /home/example.com/sqlite/mydb.db ".tables"
# Delete the database file itself (the command does not do this)
rm /home/example.com/sqlite/mydb.db
# Look up the stored password for a domain's databases
sudo sqlite3 /var/lib/sqlite/sqlite.db "select Name, Pass from SQLite where Domain='example.com'"
Output
Creating:
Database mydb created successfully...
Removing:
SQLite Access deleted successfully.
Both messages are printed even if the step did nothing, for example when the database already existed. The generated password is not printed.
See the full reference at /go/sqlite and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
