puppetlabs-mysql

25 views
Skip to first unread message

David Kindle

unread,
Jul 23, 2014, 1:07:49 PM7/23/14
to puppet...@googlegroups.com
based on the below script - My mysql instance has a password of foo already.   I want this script to use my root password to create a new db and assign a user with privileges to that db.

What is wrong with this code?  Is this trying to SET the root pass vs just using it to execute the commands?

the way this is it throws the error "Access denied for user 'root'@'localhost' (using password: NO)"

any help greatly appreciated


class {'mysql::server':
root_password => 'foo',
}

  #creates a sample db with user with correct permissions -spade
  mysql::db { $dbName:
      user     => $dbUser,
      password => $dbPass,
      host     => 'localhost',
      grant    => ['SELECT', 'INSERT', 'UPDATE', 'CREATE', 'DELETE'],
}

Hunter Haugen

unread,
Jul 23, 2014, 6:42:07 PM7/23/14
to puppet-users
The module is trying to read the cached password from /root/.my.cnf to connect, and since it's empty it tries with no password. (See https://github.com/puppetlabs/puppetlabs-mysql/blob/master/manifests/server/root_password.pp#L7-L19 for what puppet is doing with the root_password).

You could create the file /root/.my.cnf with the contents of https://github.com/puppetlabs/puppetlabs-mysql/blob/master/templates/my.cnf.pass.erb but just add your own info, then it should work and puppet should be able to manage it from there :).



-Hunter


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c11bfb37-2621-4662-9a1e-ece61c8023fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Kindle

unread,
Jul 24, 2014, 9:26:46 AM7/24/14
to puppet...@googlegroups.com
Thanks Hunter - this is the info I was looking for.   Now of course I need puppet to create this file for me since the idea here is that I dont have to touch the node.   Can you be more specific on he "just add your own info"   Is the the client/socket/unset info?  can you populate those with default typical values so I see exactly what  you mean.

tks again
Reply all
Reply to author
Forward
0 new messages