Ask Your Question
0

Duplicate declaration: Mysql_user[root@localhost] is already declared

asked 2013-10-27 14:23:36 -0500

spuder gravatar image

Using the puppet labs-mysql module 2.0.0-rc5

I'm seeing the following error when trying to import a mysql database

Error: Duplicate declaration: Mysql_user[root@localhost] is already declared in file /etc/puppet/modules/mysql/manifests/server/root_password.pp:11; cannot redeclare at /etc/puppet/modules/mysql/manifests/db.pp:35 on node alps.localdomain
Error: Duplicate declaration: Mysql_user[root@localhost] is already declared in file /etc/puppet/modules/mysql/manifests/server/root_password.pp:11; cannot redeclare at /etc/puppet/modules/mysql/manifests/db.pp:35 on node alps.localdomain

The class declarations are:

 class { 'mysql::server':
    root_password             => 'foo ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-12-13 02:06:04 -0500

ninoooo gravatar image

Got the same error!

Duplicate declaration: Mysqluser[root@localhost] is already declared in file /tmp/vagrant-puppet/modules-0/mysql/manifests/server/root password.pp at line 11; cannot redeclare at /tmp/vagrant-puppet/modules-0/mysql/manifests/server/account_security.pp:11 on node www.hsd1.wa.comcast.net . The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!

But I was able find the error that causing it and got a solution.

I'm actually using vagrant and puppet to create a centos vm. Here's my Vagrantfile snippet:

config.vm.provision :puppet do ...
(more)
edit flag offensive delete link more
0

answered 2013-10-27 14:40:48 -0500

spuder gravatar image

As it turns out, you can not import into the root account. Changing user => 'root', to user => 'foo'', resolves the issue

 class { 'mysql::server':
    root_password             => 'foo',
    remove_default_accounts  =>  true,
    override_options => { 
      'client' => { 'password' => 'foobar' } 
    }
  }

   mysql::db { "foo":
      user      => 'foo',
      password  => "foo",
      host      => 'localhost',
      grant     => ['ALL'],
      sql       =>  '/vagrant/files/bar.sql',
  }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-27 14:23:36 -0500

Seen: 3,251 times

Last updated: Dec 13 '13