mycnf

Reads MySQL options using my_print_defaults command.

Usage no npm install needed!

<script type="module">
  import mycnf from 'https://cdn.skypack.dev/mycnf';
</script>

README

mycnf

npm version Build Status npm downloads License Greenkeeper badge

Reads MySQL options using my_print_defaults command.

Install

npm install mycnf --save

Usage

const mycnf = require('mycnf');
const config = mycnf();
//> { port: '3306', socket: '/tmp/mysql.sock' }

Configuration Options

  • cmnd: Path to 'my_print_defaults' command. If no cmnd is provided, then 'my_print_defaults' command from $PATH is called.
  • file: Path of config file to read, defaults to reflecting MySQL config (usually ~/.my.cnf).
  • group: Name of config file group to parse, default to 'client'.

Environment Variables

  • MYCNF_CMND
  • MYCNF_FILE
  • MYCNF_GROUP