puppetlsabs/puppet-mysql error: access denied for user root

1,477 views
Skip to first unread message

Luca Gioppo

unread,
Sep 6, 2012, 4:15:38 AM9/6/12
to puppet...@googlegroups.com
On a second run of puppet after adding the mysql::db is not possible to create the db getting the error below

class { 'mysql::server':
         config_hash => {root_password => 'changeme',}
}
mysql::db { 'mydatabase':
         user     => 'myapp1',
         password => 'supersecret',
         host     => 'webapp1.puppetlabs.com',
}

Error: Execution of '/usr/bin/mysql -NBe create database `mydatabase` character set utf8' returned 1: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Executing the command from shell (after replacing the quotes ` with '  ) and including all the command in double quote the db gets created.
It seems that the puppet process cannot find the password that is present in the /root/.my.conf

For sure there is some problem in my installation any help?
Thanks
Luca

Luca Gioppo

unread,
Sep 6, 2012, 9:15:16 AM9/6/12
to puppet...@googlegroups.com
Ok problem solved
Evidently pupped uses the /etc/my.cfg to get the password to access to the DB
This info is not written down in the puppet-mysql template (I believe that few people use the database creation of the module).
Also there is a bit of mess right now on the writing of that file it seems that it get written by too many pieces.
In the end is possible to add the password key in that file and all goes well.
As a workaround this can be a good solution, but for long term approach I think that writing down in clear in the host the root passowrd is not a good approach, but anyway...
Thanks
Luca

Erik Dalén

unread,
Sep 6, 2012, 9:24:05 AM9/6/12
to puppet...@googlegroups.com
It is probably because $HOME isn't set properly when it is running as
an agent. There is an open pull request to fix this:
https://github.com/puppetlabs/puppetlabs-mysql/pull/92
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/zZzw5IGBF0IJ.
>
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



--
Erik Dalén
Reply all
Reply to author
Forward
0 new messages