我尝试使用 perl 配置 mySql 配置文件。 我使用 config::simple 来执行此操作。 我的代码是:
#!/bin/perl
use Config::Simple;
$cfg = new Config::Simple('/etc/mysql/my.cnf');
$cfg->param('bind-address', '192.168.1.11');
$cfg->save();
问题是,当一行只有键而没有值时,我会收到错误。如何解决这个问题?
最佳答案
延长simbabque's comment我建议使用Config::MySQL处理 MySQL 配置文件。
Config::MySQL extends Config::INI to support reading and writing MySQL-style configuration files. Although deceptively similar to standard .INI files, they can include bare boolean options with no value assignment and additional features like !include and !includedir.
关于perl - 使用 Config::Simple 读取带键但不带值的 MySQL 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39724578/