pynonymizer
pynonymizer copied to clipboard
Database host, username and password should be optional for MySQL
Is your feature request related to a problem? Please describe.
MySQL client can accept host, port, username, password and other options through option files (.cnf)
Additionally, running pynonymizer currently litters the log with the following warning:
mysql: [Warning] Using a password on the command line interface can be insecure.
Describe the solution you'd like I think these settings could be optional instead of required to run pynonymizer
Sounds logical.
do you know if this behaviour is similar across the other supported DBs (i.e. postgres, mssql)? I'm just thinking about how best to support this.
Hey @rwnx,
For PostgreSQL, there is password file(.pgpass file in a user's home directory) that can be used similarly.
For MSSQL, the current CLI (which is in preview stage) supports passing these details as environment variables.
Hi @balcsida !
Late news, but this feature was released in v1.24.0. for MySQL & postgres, you should be able to use the CLI's respective config files to pass credentials to the database.
Check out the changelog for more info: https://github.com/rwnx/pynonymizer/blob/master/CHANGELOG.md#changed
Sweeeeeeeet, thank you so much! :bow:
hi, i'm starting with pynonymizer, and I don't know how to use my.cnf for setting user/password.
I have my.cnf file:
[client]
user="user"
password="secret"
but when I run pynonymizer from shell, in same location where my.cnf is located, it's not used. What am I missing? Thanks!
hi @janpeterka !
It's hard to diagnose from the info here, but here's what i'd look into first:
we don't load my.cnf directly, we rely on the mysql client's behaviour. I don't think it loads data from the same directory. I think it loads from a list of paths, e.g. $HOME/my.cnf.
| File Name | Purpose |
|---|---|
| /etc/my.cnf | Global options |
| /etc/mysql/my.cnf | Global options |
| SYSCONFDIR/my.cnf | Global options |
| $MYSQL_HOME/my.cnf | Server-specific options (server only) |
| defaults-extra-file | The file specified with --defaults-extra-file, if any |
| ~/.my.cnf | User-specific options |
| ~/.mylogin.cnf | User-specific login path options (clients only) |
| DATADIR/mysqld-auto.cnf | System variables persisted with SET PERSIST or SET PERSIST_ONLY (server only) |
- Where is your my.cnf stored?
- are you passing any options that might interfere with this?
If you're still having trouble with this, I think you should open a new issue and we'll do a deeper investigation.
Hi, thanks so much! I never played with MySQL configuration much, so I didn't realize this :)