puppet mysql复制

jmo0nnb3  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(400)

我正在尝试用以下代码使用puppetlabs mysql模块配置mysql复制

class core {

 class { '::mysql::server':
    root_password           => '*23AE809DDACAF96AF0FD78ED04B6A265E05AA257',
    remove_default_accounts => true,
    override_options        => {
    'mysqld' => {
    'bind-address'                     => '0.0.0.0',
    'server-id'                        => '1',
    'binlog-format'                    => 'mixed',
    'log-bin'                          => 'mysql-bin',
    'datadir'                          => '/var/lib/mysql',
    'innodb_flush_log_at_trx_commit'   => '1',
    'sync_binlog'                      => '1',
    'binlog-do-db'                     => ['app_db'],
   }
  }
 }

 mysql_user { 'slave_user@%':
    ensure        => 'present',
    password_hash => mysql_password('123'),
    }

 mysql_grant { 'slave_user@%/*.*':
    ensure     => 'present',
    privileges => ['REPLICATION SLAVE'],
    table      => '*.*',
    user       => 'slave_user@%',
    }

 mysql::db { 'app_db':
 user => 'dbuser',
 password => '*23AE809DDACAF96AF0FD78ED04B6A265E05AA257',
  host => '%',
  } 
}

但是当我尝试应用这个清单时,我得到了错误消息

Notice: /Stage[main]/Mysql::Server::Root_password/File[/root/.my.cnf]/content: content changed '{md5}b52301963c1bc0d06bd0de29e43c22d1' to '{md5}ca645da4ee27089926b4c47fb2ca81a3'
Error: Failed to apply catalog: Execution of '/usr/bin/mysql --defaults-extra-file=/root/.my.cnf -NBe show databases' returned 1: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

拜托,帮帮我,我做错什么了?

evrscar2

evrscar21#

根据puppetlabs mysql/todo“1。你不能将数据库添加到一个有根密码的示例中”,我删除了所有描述mysql根用户的行,解决了我的问题。

相关问题