6.2. 更改配置文件中的默认数据库
使用未加密的 SQLite 数据库,您可以从命令行助手存储信息并可以访问您的历史记录数据库。
先决条件
- 您已安装了命令行助手。
流程
安装您选择的数据库:
要安装 MySQL,请输入:
# dnf install python3-PyMySQL要安装 PostgreSQL,请输入:
# dnf install python3-psycopg2
-
访问
/etc/xdg/command-line-assistant/config.toml的数据库配置文件。 查找并注释掉默认配置。例如:
[database] # type = "sqlite" # connection_string = "/var/lib/command-line-assistant/history.db"配置您选择的数据库。以下信息也可以在
/etc/xdg/command-line-assistant/config.toml中提供。-
设置数据库类型,其中 <
db_type> 可以是mysql或postgresql。 设置数据库详情。
type = <db_type> host = "<hostname_or_ip_address>" port = "5432" username = "<database_user_name>" password = "<password>" database = "<database_name>"
-
设置数据库类型,其中 <
更改数据库类型后,重启
clad守护进程以应用更改:$ sudo systemctl restart clad