@@ -178,6 +178,14 @@ def package(*args, &blk)
178178 action :run
179179 creates "#{ node [ 'mysql' ] [ 'data_dir' ] } /mysql"
180180 end
181+
182+ # set the root password for situations that don't support pre-seeding.
183+ # (eg. platforms other than debian/ubuntu & drop-in mysql replacements)
184+ execute "assign-root-password mac_os_x" do
185+ command %Q["#{ node [ 'mysql' ] [ 'mysqladmin_bin' ] } " -u root password '#{ node [ 'mysql' ] [ 'server_root_password' ] } ']
186+ action :run
187+ only_if %Q["#{ node [ 'mysql' ] [ 'mysql_bin' ] } " -u root -e 'show databases;']
188+ end
181189else
182190 execute 'mysql-install-db' do
183191 command "mysql_install_db"
@@ -195,15 +203,33 @@ def package(*args, &blk)
195203 end
196204end
197205
198- # set the root password for situations that don't support pre-seeding.
199- # (eg. platforms other than debian/ubuntu & drop-in mysql replacements)
200- execute "assign-root-password" do
201- command %Q["#{ node [ 'mysql' ] [ 'mysqladmin_bin' ] } " -u root password '#{ node [ 'mysql' ] [ 'server_root_password' ] } ']
202- action :run
203- only_if %Q["#{ node [ 'mysql' ] [ 'mysql_bin' ] } " -u root -e 'show databases;']
204- end
205206
206207unless platform_family? ( %w{ mac_os_x } )
208+
209+ template "#{ node [ 'mysql' ] [ 'conf_dir' ] } /my.cnf" do
210+ source "my.cnf.erb"
211+ owner "root" unless platform? 'windows'
212+ group node [ 'mysql' ] [ 'root_group' ] unless platform? 'windows'
213+ mode "0644"
214+ case node [ 'mysql' ] [ 'reload_action' ]
215+ when 'restart'
216+ notifies :restart , "service[mysql]" , :immediately
217+ when 'reload'
218+ notifies :reload , "service[mysql]" , :immediately
219+ else
220+ Chef ::Log . info "my.cnf updated but mysql.reload_action is #{ node [ 'mysql' ] [ 'reload_action' ] } . No action taken."
221+ end
222+ variables :skip_federated => skip_federated
223+ end
224+
225+ # set the root password for situations that don't support pre-seeding.
226+ # (eg. platforms other than debian/ubuntu & drop-in mysql replacements)
227+ execute "assign-root-password" do
228+ command %Q["#{ node [ 'mysql' ] [ 'mysqladmin_bin' ] } " -u root password '#{ node [ 'mysql' ] [ 'server_root_password' ] } ']
229+ action :run
230+ only_if %Q["#{ node [ 'mysql' ] [ 'mysql_bin' ] } " -u root -e 'show databases;']
231+ end
232+
207233 grants_path = node [ 'mysql' ] [ 'grants_path' ]
208234
209235 begin
0 commit comments