第 10 章 Managing databases with the command-line assistant daemon
To store information and provide access to your history database, the command-line assistant daemon (clad) uses an unencrypted SQLite database by default. If you require a different database for your deployment, you can install and connect to a different database back end, such as PostgreSQL or MySQL.
clad does not include these databases by default to avoid bringing unwanted dependencies to your system.
With the unencrypted SQLite database, you can store information and have access to your history database from the command-line assistant.
Prerequisites
- You have installed the command-line assistant.
Procedure
Install the database of your choice:
To install MySQL, enter:
# dnf install python3-PyMySQLTo install PostgreSQL, enter:
# dnf install python3-psycopg2
-
Access your database configuration file at
/etc/xdg/command-line-assistant/config.toml. Locate and comment out the default configuration. For example:
[database] # type = "sqlite" # connection_string = "/var/lib/command-line-assistant/history.db"Configure the database of your choice. The following information is also available in
/etc/xdg/command-line-assistant/config.toml.-
Set the database type, where
<db_type>can bemysqlorpostgresql. Set the database details.
type = <db_type> host = "<hostname_or_ip_address>" port = "5432" username = "<database_user_name>" password = "<password>" database = "<database_name>"
-
Set the database type, where
After changing the database type, restart the
claddaemon to apply the changes:$ sudo systemctl restart clad