MYANON(1)
MYANON(1) π
okay bestie, you found the myanon page β the MySQL dump anonymizer that's lowkey a whole vibe. β¨
πΈ NAME πΈ
myanon β MySQL dump anonymizer π«Ά
β¨ SYNOPSIS β¨
myanon -f config_file [-d]
π DESCRIPTION π
okay so myanon reads a MySQL dump (the kind mysqldump(1) makes) from standard input and writes an anonymized version to standard output. no cap.
Anonymization is deterministic: it uses HMAC-SHA256 keyed by a shared secret, so identical input values always produce the same anonymized output. this preserves referential integrity across foreign keys β iconic behavior, honestly.
myanon works on flat (numeric and text) fields and has built-in support for JSON fields. optional Python support lets you use custom anonymization functions (e.g. using faker). π
π OPTIONS π
-f config_fileβ path to the configuration file. it's required, bestie.-dβ enable debug mode. prints debug information to standard error.-v,--versionβ print version information and exit.-h,--helpβ print a usage summary and exit.
π¦ CONFIGURATION FILE π¦
the configuration file is a text file with the following directives.
π Global directives π
secret = 'keyΒ΄β HMAC secret, up to 64 characters.stats = 'yes|noΒ΄β when set to yes, statistics are appended as SQL comments at the end of the output.pypath = 'pathΒ΄β directory where the Python script is located. may be relative or absolute. the environment variablePYTHONPATHcan also be used. only available when compiled with Python support (--enable-python).pyscript = 'nameΒ΄β name of the Python script (without the.pyextension). only available when compiled with Python support.
π Tables block π
the tables block lists tables and their anonymization rules:
tables = {
`table` = {
`field` = rule
...
}
`other_table` = truncate
}
table and field names are enclosed in backticks. tables may also be matched using a regular expression with the regex prefix:
regex `(prod|test)players` = {
`lastname` = texthash 20
`firstname` = texthash 20
}
π ANONYMIZATION RULES π
the following anonymization rules are available. most rules can take an optional 'cΒ΄ suffix to handle multiple values within a single field, separated by character c. π
texthash Nβ hash the value into a readable text string of N characters (max 32).inthash Nβ hash the value into a numeric string of N digits (max 32).emailhash 'domain' Nβ hash the value into an email address ending with domain, N characters long in total (max 32).fixed 'valueΒ΄β replace the field with a fixed value. quoting follows the field type (text fields are quoted, numeric fields are not). quoting can be overridden with thequotedorunquotedkeyword before the value:
fixed 'myvalue'
fixed quoted '5'
fixed unquoted '0x1234'
fixed nullβ replace the field with SQL NULL.keyβ tag this field as the key column. its anonymized value is remembered and can be referenced byappendkeyorprependkeyrules in other columns of the same table.appendkey 'prefix'β replace the field with prefix followed by the current key value. requires akeycolumn in the same table.prependkey 'suffix'β replace the field with the current key value followed by suffix. requires akeycolumn in the same table.appendindex 'prefix'β replace the field with prefix followed by the current row index (starting at 1).prependindex 'suffix'β replace the field with the current row index followed by suffix.substring Nβ truncate the field value to the first N characters.json { path 'jsonpath' = rule ... }β apply anonymization rules to specific paths within a JSON field. paths use dot notation for nested objects (e.g.address.street) and brackets for arrays (e.g.items[]). each path is followed by one of the rules above. example:
`data` = json {
path 'email' = emailhash 'example.com' 20
path 'address.street' = texthash 15
path 'items[]' = texthash 10
}
pydef 'function'β call a custom Python function for anonymization. the function must be defined in the script specified bypyscriptand accept a single parameter (the value to anonymize). only available when compiled with Python support.truncateβ remove allINSERTandUPDATEstatements for this table (table-level rule).
πΈ EXAMPLES πΈ
anonymize a dump file:
mysqldump mydb | myanon -f myanon.conf > mydb_anon.sql
create both a real encrypted backup and an anonymized backup from a single dump:
mysqldump mydb | \
tee >(myanon -f myanon.conf | gzip > mydb_anon.sql.gz) | \
gpg -e -r me@domain.com > mydb.sql.gz.gpg
β¨ EXIT STATUS β¨
0β successful completion.1β an error occurred (configuration error, parse error, etc.).
π₯ SEE ALSO π₯
π BUGS π
report bugs to <pierre.pomes@gmail.com> or at https://github.com/ppomes/myanon/issues.
π AUTHORS π
Pierre Pomes.
okay bestie, that's the whole MYANON(1) page β this is myanon 0.8, dated 2026-02-05, and yes, it ate. mwah π
π¦ where this page comes from
- nixos 26.05: myanon 0.8.3
- nixpkgs unstable: myanon 0.8.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms