Puppet: Exec[set_mysql_rootpw]/returns: change from notrun to 0 failed

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

I had this error trying to manage MySQL in Puppet and thought I'd post my solution for anyone searching the Interwebs:

err: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: change from notrun to 0 failed: mysqladmin -u root  password mypass returned 1 instead of one of [0] at /etc/puppet/modules/mysql/manifests/config.pp:94

Specifically what was failing for me was the initialisation of MySQL, from my manifest:

class { 'mysql::server':
  config_hash => { 'root_password' => '<password>' }
}

Puppet was attempting to set the root password (which is actually blank having just installed MySQL), but there was already a password in /root/.my.cnf so instead of logging in to MySQL with a blank root password, Puppet was trying to use the password from /root/.my.cnf.

So, just run:

rm /root/.my.cnf

Then re-apply your Puppet manifest to get past the error. Hope this helps someone!

a Padded Cell our articles site!