Not sure what's causing this error for you, but
here's how I install MySQL in my recipe. I'm using Chef server,
not Chef solo.
In my cookbook's recipe (note that I didn't put these under
any "if" statement):
# Install MySQL
include_recipe "mysql::server"
include_recipe "mysql::client"
include_recipe "database::mysql"
# Create database
mysql_connection_info = {:host => 'localhost',
:username => 'root', :password =>
node[:mysql][:server_root_password]}
mysql_database 'mydb' do
connection
mysql_connection_info
action
:create
end
# Create tables
mysql_database 'mydb' do
connection
mysql_connection_info
sql {
::File.open("#{$mydir}/mytables.sql").read }
action
:query
end
# Create user
mysql_database_user 'myuser' do
connection
mysql_connection_info
password
'mypass'
action
:create
end
# Grant privileges to user
mysql_database_user 'myuser' do
connection
mysql_connection_info
password
'mypass'
database_name
'mydb'
host '%'
privileges
[:all]
action
:grant
end
Hope this helps.