O'Reilly logo

MySQL in a Nutshell by Russell J.T. Dyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

my_print_defaults

Synopsis

my_print_defaults options filename

Use this to parse a configuration file so as to convert key/value pairs into command-line equivalent options. For instance, a line from the my.cnf file that reads basedir=/data/mysql will be converted to the --basedir=/data/mysql. To export the MySQL daemon (i.e., mysqld) section of my.cnf file, enter the following from the command line (the output follows):

my_print_defaults --config-file=/etc/my.cnf mysqld
--basedir=/data/mysql
--datadir=/data/mysql
--socket=/tmp/mysql.sock
--tmpdir=/tmp
--log-bin=/data/mysql/logs/log-bin

Notice that only the mysqld section is parsed and the header [mysqld] and the blank lines are not included in the output. Also, each key/value pair is printed on separate lines. To parse more than one section, you can list additional section names at the end of the command line, separated by spaces.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required