在 MariaDB 中存储密码/登录路径的位置(相当于 mysql-config-editor)?

rmu*_*ler 7 mysql security mariadb

我们目前使用 MySQL 5.7 并通过mysql-config-editor存储密码。它将登录路径存储在加密文件中.mylogin.cnf

MariaDB 不支持此功能(并认为这是一个坏主意)。那么,MariaDB 的做法是什么?

PostgreSQL 提供~/.pgpass了这个目的。

Cal*_*pin 7

You can use an unencrypted options file. Create a new options file in your home directory, readable only by you, like this:

[client]
host='<your-db-host>'
port='<your-db-port>'
socket='<your-db-socket>'
database='<your-db-name>'
user='<your-db-user>'
password='<your-db-password>'
Run Code Online (Sandbox Code Playgroud)

You can then use with a --defaults-extra-file= option when running one of the clients.

Configuring MariaDB with Option Files

You can create different config files for each login path you would have created.

MariaDB 团队认为,经过混淆的文件只会提供一种虚假的安全感,因此您最好直面将密码以明文形式放入文件系统的事实。如果您正确配置了文件权限,这可能是可以接受的情况。