目前Ubuntu上的puppetlabs-mysql模块有诀窍吗?

时间:2013-01-03 09:04:39

标签: mysql ubuntu puppet vagrant

有一个正在运行的github线程(看起来已经关闭并且已经完成了一堆提交/合并)。

尽管VirtualBox和Vagrant不到2周:*编辑:我仍然看到与/root/.my.cnf相关的错误。

我将mysql和stdlib模块更新为master。

# MySQL Server
class { 'mysql::server':
    config_hash => {
       'root_password' => 'foobah'
    }
 }

#class { 'mysql::server': } have tried it like this to try not having a root password. But it still attempted to use the /root/.my.cnf file. 

mysql::db { 'data_base':
    user     => 'user',
    password => 'pass',
    host     => 'localhost',
    grant    => ['all'],
    charset => 'utf8',
}

每当它执行以root身份创建DB等的命令时,我得到:

err: /Stage[main]//Mysql::Db[data_base]/Database[data_base]/ensure: change from absent to present failed: Execution of '/usr/bin/mysql --defaults-file=/root/.my.cnf -NBe create database `data_base` character set utf8' returned 1: Could not open required defaults file: /root/.my.cnf
Fatal error in defaults handling. Program aborted

2 个答案:

答案 0 :(得分:2)

是的,这是一个排序问题(在开发我自己的(工作)Ubuntu mysql清单后,我更清楚地知道要查找什么)。

需要mysql :: db部分:

require => File['/root/.my.cnf'],

修改后添加:

# MySQL Server
class { 'mysql::server':
    config_hash => {
       'root_password' => 'foobah'
    }
}

mysql::db { 'data_base':
    user     => 'user',
    password => 'pass',
    host     => 'localhost',
    grant    => ['all'],
    charset => 'utf8',
    require => File['/root/.my.cnf'],
}

答案 1 :(得分:0)

我很好奇,基于提到/root/.my.cnf的错误 - 这个文件的权限是什么?你能粘贴这个命令的输出吗?

stat /root/.my.cnf && lsattr /root/.my.cnf

这听起来像权限可能是问题,但我需要在知道之前看到权限,因为这现在不可重现。此外,现在不重要,但可能是我们进一步钻研;您正在运行哪个版本的Puppet?