Daniel Upton
Daniel Upton

Reputation: 5751

How do you set the MySQL root password using chef solo without storing it in plain text?

I've been trying to automate as much of our infrastructure as possible, by moving our server set up and configuration to chef solo.

Using the OpsCode MySQL cookbook, I am able to install MySQL and set the root password like so:

node['mysql']['server_root_password'] = 'my root password'

(or the JSON equivalent)

This works fine, but ideally we'd like to not store the password in plain text as it will be going on GitHub (private repository of course, but you never know).

Is there a way I can supply a hash of the password instead (similar to a user definition in chef),

Upvotes: 1

Views: 1599

Answers (1)

O. Jones
O. Jones

Reputation: 108839

Copy the hashed password value you want and use it in place of your plain-text password.

Do

 SELECT Password
   FROM mysql.user
  WHERE User='root'
    AND Host='localhost'

to get the hashed value from an existing MySQL instance.

Upvotes: 1

Related Questions