Giter Club home page Giter Club logo

mysql's Introduction

MySQL Cookbook

Cookbook Version Build Status OpenCollective OpenCollective License

The MySQL Cookbook is a library cookbook that provides resource primitives (LWRPs) for use in recipes. It is designed to be a reference example for creating highly reusable cross-platform cookbooks.

Scope

This cookbook is concerned with the "MySQL Community Server", particularly those shipped with F/OSS Unix and Linux distributions. It does not address forks or value-added repackaged MySQL distributions like MariaDB or Percona.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

  • Chef 15.5 or higher
  • Network accessible package repositories
  • 'recipe[selinux::disabled]' on RHEL platforms

Platform Support

The following platforms have been tested with Test Kitchen:

OS 5.6 5.7 8.0
centos-7 X X X
centos-8 X X
debian-9 X
debian-10 X
fedora X X X
openSUSE Leap X
ubuntu-18.04 X
ubuntu-20.04 X
ubuntu-22.04 X

Cookbook Dependencies

There are no hard coupled dependencies. However, there is a loose dependency on yum-mysql-community for RHEL/CentOS platforms. As of the 8.0 version of this cookbook, configuration of the package repos is now the responsibility of the user.

Usage

Place a dependency on the mysql cookbook in your cookbook's metadata.rb

depends 'mysql'

Then, in a recipe:

mysql_service 'foo' do
  port '3306'
  version '8.0'
  initial_root_password 'change me'
  action [:create, :start]
end

The service name on the OS is mysql-foo. You can manually start and stop it with service mysql-foo start and service mysql-foo stop.

If you use default as the name the service name will be mysql instead of mysql-default.

The configuration file is at /etc/mysql-foo/my.cnf. It contains the minimum options to get the service running. It looks like this.

# Chef generated my.cnf for instance mysql-foo

[client]
default-character-set          = utf8
port                           = 3306
socket                         = /var/run/mysql-foo/mysqld.sock

[mysql]
default-character-set          = utf8

[mysqld]
user                           = mysql
pid-file                       = /var/run/mysql-foo/mysqld.pid
socket                         = /var/run/mysql-foo/mysqld.sock
port                           = 3306
datadir                        = /var/lib/mysql-foo
tmpdir                         = /tmp
log-error                      = /var/log/mysql-foo/error.log
!includedir /etc/mysql-foo/conf.d

[mysqld_safe]
socket                         = /var/run/mysql-foo/mysqld.sock

You can put extra configuration into the conf.d directory by using the mysql_config resource, like this:

mysql_service 'foo' do
  port '3306'
  version '8.0'
  initial_root_password 'change me'
  action [:create, :start]
end

mysql_config 'foo' do
  source 'my_extra_settings.erb'
  instance 'foo'
  notifies :restart, 'mysql_service[foo]'
  action :create
end

You are responsible for providing my_extra_settings.erb in your own cookbook's templates folder. The name of the mysql service instance must be provided in mysql config as this defaults to 'default'.

Connecting with the mysql CLI command

Logging into the machine and typing mysql with no extra arguments will fail. You need to explicitly connect over the socket with mysql -S /var/run/mysql-foo/mysqld.sock, or over the network with mysql -h 127.0.0.1

Upgrading from older version of the mysql cookbook

  • It is strongly recommended that you rebuild the machine from scratch. This is easy if you have your data_dir on a dedicated mount point. If you must upgrade in-place, follow the instructions below.
  • The 6.x series supports multiple service instances on a single machine. It dynamically names the support directories and service names. /etc/mysql becomes /etc/mysql-instance_name. Other support directories in /var /run etc work the same way. Make sure to specify the data_dir property on the mysql_service resource to point to the old /var/lib/mysql directory.

Resources

Advanced Usage Examples

There are a number of configuration scenarios supported by the use of resource primitives in recipes. For example, you might want to run multiple MySQL services, as different users, and mount block devices that contain pre-existing databases.

Multiple Instances as Different Users

# instance-1
user 'alice' do
  action :create
end

directory '/mnt/data/mysql/instance-1' do
  owner 'alice'
  action :create
end

mount '/mnt/data/mysql/instance-1' do
  device '/dev/sdb1'
  fstype 'ext4'
  action [:mount, :enable]
end

mysql_service 'instance-1' do
  port '3307'
  run_user 'alice'
  data_dir '/mnt/data/mysql/instance-1'
  action [:create, :start]
end

mysql_config 'site config for instance-1' do
  instance 'instance-1'
  source 'instance-1.cnf.erb'
  notifies :restart, 'mysql_service[instance-1]'
end

# instance-2
user 'bob' do
  action :create
end

directory '/mnt/data/mysql/instance-2' do
  owner 'bob'
  action :create
end

mount '/mnt/data/mysql/instance-2' do
  device '/dev/sdc1'
  fstype 'ext3'
  action [:mount, :enable]
end

mysql_service 'instance-2' do
  port '3308'
  run_user 'bob'
  data_dir '/mnt/data/mysql/instance-2'
  action [:create, :start]
end

mysql_config 'site config for instance-2' do
  instance 'instance-2'
  source 'instance-2.cnf.erb'
  notifies :restart, 'mysql_service[instance-2]'
end

Replication Testing

Use multiple mysql_service instances to test a replication setup. This particular example serves as a smoke test in Test Kitchen because it exercises different resources and requires service restarts.

https://github.com/sous-chefs/mysql/blob/main/test/cookbooks/test/recipes/service_multi.rb

Frequently Asked Questions

How do I run this behind my firewall

On Linux, the mysql_service resource uses the platform's underlying package manager to install software. For this to work behind firewalls, you'll need to either:

  • Configure the system yum/apt utilities to use a proxy server that
  • can reach the Internet
  • Host a package repository on a network that the machine can talk to

On the RHEL platform_family, applying the yum::default recipe will allow you to drive the yum_globalconfig resource with attributes to change the global yum proxy settings.

If hosting repository mirrors, applying one of the following recipes and adjust the settings with node attributes.

The mysql command line doesn't work

If you log into the machine and type mysql, you may see an error like this one:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

This is because MySQL is hardcoded to read the defined default my.cnf file, typically at /etc/my.cnf, and this LWRP deletes it to prevent overlap among multiple MySQL configurations.

To connect to the socket from the command line, check the socket in the relevant my.cnf file and use something like this:

mysql -S /var/run/mysql-foo/mysqld.sock -Pwhatever

Or to connect over the network, use something like this: connect over the network..

mysql -h 127.0.0.1 -Pwhatever

These network or socket ssettings can also be put in you $HOME/.my.cnf, if preferred.

What about MariaDB, Percona, etc

MySQL forks are purposefully out of scope for this cookbook. This is mostly to reduce the testing matrix to a manageable size. Cookbooks for these technologies can easily be created by copying and adapting this cookbook. However, there will be differences.

Package repository locations, package version names, software major version numbers, supported platform matrices, and the availability of software such as XtraDB and Galera are the main reasons that creating multiple cookbooks to make sense.

There are existing cookbooks to carter for these forks, check them out on the supermarket

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

mysql's People

Contributors

acoulton avatar aleksey-hariton-epam avatar btm avatar ctdk avatar daften avatar damacus avatar emh333 avatar iennae avatar johnroesler avatar josegonzalez avatar josephholsten avatar jschneiderhan avatar kitchen-porter avatar kramvan1 avatar lamont-granquist avatar mancdaz avatar mattray avatar mbaitelman avatar p8 avatar ramereth avatar renovate[bot] avatar reset avatar schisamo avatar sekipaolo avatar sethvargo avatar someara avatar stevenbarre avatar tas50 avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql's Issues

Allow setting open_files_limit in server config

my.cnf.erb

<% if @open_files_limit %>
open_files_limit               = <%= @open_files_limit %>
<% end %>

Also note that the configuration template is not particularly flexible....wouldn't it be better to loop over an array of configurations keys/values ?

Ubuntu 14.04 mysql-server-5.6 : Depends: mysql-client-5.6

on Ubuntu 14.04 i'm trying to install mysql server. I put the mysql::server in my run list followed by a wrapper cookbook what depends on mysql and include_recipe ''mysql::server" but the build fails.

The following packages have unmet dependencies:
 mysql-server-5.6 : Depends: mysql-client-5.6 (>= 5.6.19-0ubuntu0.14.04.1) but it is not going to be installed
STDERR: E: Unable to correct problems, you have held broken packages.
---- End output of apt-get -q -y install mysql-server-5.6=5.6.19-0ubuntu0.14.04.1 ----
Ran apt-get -q -y install mysql-server-5.6=5.6.19-0ubuntu0.14.04.1 returned 100

If i put mysql::client in the run list it's ok but now i have to wrap the mysql::client cookbook so i can specify the 5.6 version. is that really necessary? i feel like i'm missing something.

undefined method bind_address not found when using the example from the Readme.

When using the following:

depends 'mysql', '~> 6.0'

Then, in a recipe:

mysql_service 'default' do
  bind_address '0.0.0.0'
  ...
end

I get the following fatal error:

================================================================================
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/frontend_server/recipes/default.rb
================================================================================

[0mNoMethodError
-------------
undefined method `bind_address' for Chef::Resource::MysqlService

←[0mCookbook Trace:
---------------
  /tmp/kitchen/cache/cookbooks/frontend_server/recipes/databases.rb:57:in `block in from_file'
←[0m  /tmp/kitchen/cache/cookbooks/frontend_server/recipes/databases.rb:56:in `from_file'
[0m  /tmp/kitchen/cache/cookbooks/frontend_server/recipes/default.rb:22:in `from_file'

←[0mRelevant File Content:
----------------------
/tmp/kitchen/cache/cookbooks/frontend_server/recipes/databases.rb:
←[0m
←[0m 50:    connection_params = {
←[0m 51:      host: master_db_host[0]['ip'],
←[0m 52:      username: 'root',
←[0m 53:      password: master_db_host[0]['root_pw']
←[0m 54:    }
←[0m 55:  else
←[0m 56:    mysql_service 'default' do
←[0m 57>>     bind_address '0.0.0.0'
←[0m 58:      port '3306'
←[0m 59:      version '5.5'
←[0m 60:      initial_root_password node['mysql']['server_root_password']
←[0m 61:      action [:create, :start]
←[0m 62:    end
←[0m 63:
←[0m 64:    mysql_config 'default' do
←[0m 65:      source 'mysite.cnf.erb'
←[0m 66:      notifies :restart, 'mysql_service[default]'
←[0m
←[0m←[0m
Running handlers:
[2014-12-18T10:41:36+00:00] ERROR: Running exception handlers
Running handlers complete
←[0m[2014-12-18T10:41:36+00:00] ERROR: Exception handlers complete
[2014-12-18T10:41:36+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 50.174843339 seconds
[2014-12-18T10:41:36+00:00] ERROR: undefined method `bind_address' for Chef::Resource::MysqlService
[2014-12-18T10:41:38+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Upgrade path from 5.x to 6.x

Is there an upgrade path for servers that are already initiated with mysql <=5.6.1?
Some installations require the socket access to mysql.
The different service names might also form problems is there a way to have the default mysql service also installed with 6.x?

Having an Issue Going from Zero to Live on RHEL-7

I was running through a default installation and ran into an issue with the following AMI:

 ami-99bef1a9

Here are my notes and my recipe

  • Built the basic cookbook, based on the instructions on MySQL github page:
mysql_service 'default' do
  bind_address '0.0.0.0'
  port '3306'
  version '5.5' # changed later, see notes
  initial_root_password 'hunter2' #obviously fake
  action [:create, :start]
end

mysql_config 'default' do
  source 'mysite.cnf.erb'
  notifies :restart, 'mysql_service[default]'
  action :create
end

-- (BTW, it's super annoying that it doesn't download all dependencies automatically!)

  • Knife uploaded the cookbook and went to the directory to chef-client
  • Failed, due to mysql55-community repo not being available
  • Had to eventually skip if unavailable, and upgraded yum
  • Tried to run chef-client again, and still failed
  • Downloaded the most recent mysql cookbook from Github
  • Then hacked again at the cookbook, and changed mysql to '5.7'
  • Still didn't work, happened to randomly enter one of the errors in google and came back with the rhel update site for adjusting repos
  • Found this - http://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html -- and did this:
    yum repolist all | grep mysql
    sudo yum-config-manager --disable mysql56-community
    sudo yum-config-manager --enable mysql57-community
  • (This is because both repos were installed)
  • Now the client worked - up to the point of start
  • The server doesn't start, however, due to a perm issue
  • [Here's where I'm stuck]

provision a docker container

I’m trying to use kitchen-docker with chef_solo to provision mysql::server cookbook inside a docker container (host: centos6 with devicemapper backend storage and docker container is ubuntu14.04). but during the cook I got a “ERROR 2002 (HY000): Can't connect to local MySQL” during the execute[install-grants].

here is the output : https://gist.github.com/thpham/aa37d305c1341099e51c

Thanks

@config params not found

Hi there, I can't tell if this is an issue with the mysql cookbook or my architecture. I'm deploying a mysql instance with this.

I followed the basic example you guys have in the readme, with one small modification since it couldn't find the my.cnf.erb in the mysql cookbook, I placed it in my digitalocean cookbook templates folder.

Then when I ran it, I got this output. It can't find the @config.anything. At first, it was @config.name, which should default to the resource name 'default'. I tried using the config_name to force it and it still failed. Then I removed any reference to @config.name and it just went to the next @config parm in the template @config.charset, also not found.

I assumed that this meant it could not find anything in the @config instance.

Any help to get me going on this would be great.

Thanks.

Debian pass_string helper regression introduced in v5.5.1

53dcd23 introduced a space after the "-p" switch in the pass_string method of libraries/helpers_debian.rb. This breaks installing mysql_grants etc and I believe this should be reverted.

The MySQL docs are explicit that "for the short form, if the password value is given, it must follow the option letter with no intervening space". Not clear as to why this change was introduced to "fix debian pass_string" as noted in the commit.

http://dev.mysql.com/doc/refman/5.5/en/command-line-options.html

Remove or upgrade the repl user hard coded into default grants

Looking to get a consensus on either removing or adding additional features to the repl user that is hard coded as:

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%'

Most replication wrapper cookbooks already address this user in a more granular way, which is better for security (allowing changing of the username as well as setting specific IP ranges).

I'm happy to write up a PR to either add additional features or remove this GRANT, but want to get some community feedback on the issue before I proceed.

Version 5.6.1 fails when using database cookbook (v2.3.0)

In a wrapper cookbook I have this line:
include_recipe "database"
Which is firing this exception:
Generated at 2014-11-03 17:40:12 -0430 Chef::Exceptions::RecipeNotFound: could not find recipe ruby for cookbook mysql

This happens in both Debian 7 and Ubuntu 12.04, using database cookbook version 2.3.0 and mysql cookbook version 5.6.1. I downgraded to mysql cookbook version 5.5.3 and with only this change everything is working again.

Thanks in advance for your reviewing.

Version 5.6 fails on CentOS 6.5

CentOS 6.5 platform, set attribute ['mysql']['server_package_version'] = "5.6", running of recipe fails when attempting download package "mysql-server" version "5.6". Could mysql 5.6(mysql-community-server) for RHEL be added to helpers?

Cookbook files with version 5.5.4 on Ubuntu 14.04

Hi!

I'm getting this error when trying to use mysql cookbook version 5.5.4. It happens on a fresh machine. Please see if you can fix it and thanks in advance!

Recipe: mysql::server

* mysql_service[default] action create

Error executing action create on resource 'mysql_service[default]'

NoMethodError

undefined method `sensitive' for Chef::Resource::Execute

Cookbook Trace:

/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:61:in block (2 levels) in <class:Ubuntu>' /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:60:inblock in class:Ubuntu'

Resource Declaration:

In /var/chef/cache/cookbooks/mysql/recipes/server.rb

20: mysql_service node['mysql']['service_name'] do
21: version node['mysql']['version']
22: port node['mysql']['port']
23: data_dir node['mysql']['data_dir']
24: server_root_password node['mysql']['server_root_password']
25: server_debian_password node['mysql']['server_debian_password']
26: server_repl_password node['mysql']['server_repl_password']
27: allow_remote_root node['mysql']['allow_remote_root']
28: remove_anonymous_users node['mysql']['remove_anonymous_users']
29: remove_test_database node['mysql']['remove_test_database']
30: root_network_acl node['mysql']['root_network_acl']
31: package_version node['mysql']['server_package_version']
32: package_action node['mysql']['server_package_action']
33: action :create
34: end

Compiled Resource:

Declared in /var/chef/cache/cookbooks/mysql/recipes/server.rb:20:in `from_file'

mysql_service("default") do
action [:create]
retries 0
retry_delay 2
guard_interpreter :default
cookbook_name "mysql"
recipe_name "server"
port "3306"
data_dir "/var/lib/mysql"
server_root_password "my_root_password"
server_debian_password "my_debian_password"
server_repl_password "my_repl_password"
remove_anonymous_users true
remove_test_database true
package_action "install"
end

Adding flag to avoid starting mysql service

Version:

5.3.6

Environment:

Ubuntu 14.04

Scenario:

Setting up a mysql cluster using corosync & pacemaker, it is necessary to avoid starting mysql service, because pacemaker is managing the execution of the mysql service. I didn't find a possibility to prevent mysql service being (re-)started at the chef-client run.

Steps to Reproduce:

  • Setting up a machine with mysql
  • Stopping mysql service manually (service mysql stop)
  • Executing chef-client run

Expected Result:

The mysql instance should remain in it's current status, that is "not running".

Actual Result:

Result is a running mysql instance.

MySQL >= 5.6.8 causes failure due to random password on RPM install

New versions of MySQL (>= 5.6.8) set a random password for unattended installations (ie: RPMs). This causes the mysql cookbook to fail to set the desired password for the server because it can no longer login as root with the (previously default) empty password string.

See documentation on the mysql site:
http://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html#option_mysql_install_db_random-passwords

The provider_mysql_service_.rb libraries need to be updated to read the randomly generated password from ~/mysql_secret and use that to login and change the server password to the desired password.

For example (actual implementation may vary):

        ruby_block 'assign-root-password' do
          block do
            escaped_password=Shellwords.escape(new_resource.server_root_password)
            node.default['mysql_random_password']=`pw=\"\"; for i in $(cat ~/.mysql_secret) ; do pw=$i ; done; echo -n $pw`
            command = "#{prefix_dir}/bin/mysqladmin -u root -p#{node['mysql_random_password']} password #{escaped_password}"
            output=`#{command}`
          end
          action :create
        end

Also, the ordering of the resource execution needs to be modified such that the my.cnf template is created before the mysql service is started.

MySQL socket disappears after several minutes on Ubuntu 14.04

Trying to get mysql up and running and I have a cookbook with the following in the default recipe...

include_recipe 'mysql::server'
include_recipe 'mysql::client'

No attributes, nothing other than defaults. Testing using the vagrant box 'chef/ubuntu-14.04'

ls -al /var/run/mysqld immediately after the chef run yields...

srwxrwxrwx  1 mysql mysql   0 Sep  4 04:40 mysqld.sock
-rw-rw----  1 mysql mysql   5 Sep  4 04:40 mysql.pid

I wait five minutes and then check the directory again... and it's empty. The following is at the end of my mysql error.log at /var/log/mysql/error.log:

Version: '5.5.38-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
140904  4:35:13 [Note] /usr/sbin/mysqld: Normal shutdown

140904  4:35:13 [Note] Event Scheduler: Purging the queue. 0 events
140904  4:35:13  InnoDB: Starting shutdown...
140904  4:35:14  InnoDB: Shutdown completed; log sequence number 1595685
140904  4:35:14 [Note] /usr/sbin/mysqld: Shutdown complete

ps ax | grep mysql and service mysql status both show that mysql is still running, so it's just the socket that's gone.

Is this a known bug on your part? I would assume that using the mysql server recipe in this cookbook with all defaults should result in a stable service, so something's got to be wrong.

cookbook doesn't work on Amazon 2014.03

I am using Packer to build an Amazon AMI that installs mysql by mysql cookbook (version 5.5.1). It fails due to yum repo conflicts.

Linux version

[ec2-user@ip-xxxxxxxxx ~]$ cat /etc/system-release
Amazon Linux AMI release 2014.03
[ec2-user@ip-xxxxxxxxx ~]$ cat /etc/system-release-cpe
cpe:/o:amazon:linux:2014.03:ga

Chef messages

    amazon-ebs: * execute[yum-makecache-mysql55-community] action run
    amazon-ebs: - execute yum -q makecache --disablerepo=* --enablerepo=mysql55-community
    amazon-ebs: * ruby_block[yum-cache-reload-mysql55-community] action create
    amazon-ebs: - execute the ruby block yum-cache-reload-mysql55-community
    amazon-ebs: * execute[yum-makecache-mysql55-community] action nothing (skipped due to action :nothing)
    amazon-ebs: * ruby_block[yum-cache-reload-mysql55-community] action nothing (skipped due to action :nothing)
    amazon-ebs:
    amazon-ebs: - evaluate block and run any associated actions
    amazon-ebs: * package[mysql-community-server] action install
    amazon-ebs:
    amazon-ebs: ================================================================================
    amazon-ebs: Error executing action `install` on resource 'package[mysql-community-server]'
    amazon-ebs: ================================================================================
    amazon-ebs:
    amazon-ebs: Chef::Exceptions::Exec
    amazon-ebs: ----------------------
    amazon-ebs: returned 1, expected 0
    amazon-ebs:
    amazon-ebs: Resource Declaration:
    amazon-ebs: ---------------------
    amazon-ebs: # In /tmp/packer-chef-solo/cookbooks-0/mysql/libraries/provider_mysql_service_rhel.rb
    amazon-ebs:
    amazon-ebs: 32:           package new_resource.parsed_package_name do
    amazon-ebs: 33:             action new_resource.parsed_package_action
    amazon-ebs: 34:             version new_resource.parsed_package_version
    amazon-ebs: 35:           end
    amazon-ebs: 36:
    amazon-ebs:
    amazon-ebs: Compiled Resource:
    amazon-ebs: ------------------
    amazon-ebs: # Declared in /tmp/packer-chef-solo/cookbooks-0/mysql/libraries/provider_mysql_service_rhel.rb:32:in `block in <class:Rhel>'
    amazon-ebs:
    amazon-ebs: package("mysql-community-server") do
    amazon-ebs: action [:install]
    amazon-ebs: retries 0
    amazon-ebs: retry_delay 2
    amazon-ebs: guard_interpreter :default
    amazon-ebs: package_name "mysql-community-server"
    amazon-ebs: version "5.5.39-5.el6"
    amazon-ebs: timeout 900
    amazon-ebs: cookbook_name :mysql
    amazon-ebs: end
    amazon-ebs:
    amazon-ebs:
    amazon-ebs: ================================================================================
    amazon-ebs: Error executing action `create` on resource 'mysql_service[default]'
    amazon-ebs: ================================================================================
    amazon-ebs:
    amazon-ebs: Chef::Exceptions::Exec
    amazon-ebs: ----------------------
    amazon-ebs: package[mysql-community-server] (/tmp/packer-chef-solo/cookbooks-0/mysql/libraries/provider_mysql_service_rhel.rb line 32) had an error: Chef::Exceptions::Exec:  returned 1, expected 0
    amazon-ebs:
    amazon-ebs: Resource Declaration:
    amazon-ebs: ---------------------
    amazon-ebs: # In /tmp/packer-chef-solo/cookbooks-0/mysql/recipes/server.rb
    amazon-ebs:
    amazon-ebs: 20: mysql_service node['mysql']['service_name'] do
    amazon-ebs: 21:   version node['mysql']['version']
    amazon-ebs: 22:   port node['mysql']['port']
    amazon-ebs: 23:   data_dir node['mysql']['data_dir']
    amazon-ebs: 24:   server_root_password node['mysql']['server_root_password']
    amazon-ebs: 25:   server_debian_password node['mysql']['server_debian_password']
    amazon-ebs: 26:   server_repl_password node['mysql']['server_repl_password']
    amazon-ebs: 27:   allow_remote_root node['mysql']['allow_remote_root']
    amazon-ebs: 28:   remove_anonymous_users node['mysql']['remove_anonymous_users']
    amazon-ebs: 29:   remove_test_database node['mysql']['remove_test_database']
    amazon-ebs: 30:   root_network_acl node['mysql']['root_network_acl']
    amazon-ebs: 31:   package_version node['mysql']['server_package_version']
    amazon-ebs: 32:   package_action node['mysql']['server_package_action']
    amazon-ebs: 33:   action :create
    amazon-ebs: 34: end
    amazon-ebs:
    amazon-ebs: Compiled Resource:
    amazon-ebs: ------------------
    amazon-ebs: # Declared in /tmp/packer-chef-solo/cookbooks-0/mysql/recipes/server.rb:20:in `from_file'
    amazon-ebs:
    amazon-ebs: mysql_service("default") do
    amazon-ebs: action [:create]
    amazon-ebs: retries 0
    amazon-ebs: retry_delay 2
    amazon-ebs: guard_interpreter :default
    amazon-ebs: cookbook_name :mysql
    amazon-ebs: recipe_name "server"
    amazon-ebs: port "3306"
    amazon-ebs: data_dir "/var/lib/mysql"
    amazon-ebs: server_root_password "ilikerandompasswords"
    amazon-ebs: server_debian_password "gnuslashlinux4ev4r"
    amazon-ebs: remove_anonymous_users true
    amazon-ebs: remove_test_database true
    amazon-ebs: package_action "install"
    amazon-ebs: end
    amazon-ebs:
    amazon-ebs:
    amazon-ebs: Running handlers:
    amazon-ebs: [2014-09-05T18:52:52+00:00] ERROR: Running exception handlers
    amazon-ebs: Running handlers complete
    amazon-ebs: [2014-09-05T18:52:52+00:00] ERROR: Exception handlers complete
    amazon-ebs: [2014-09-05T18:52:52+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    amazon-ebs: Chef Client failed. 36 resources updated in 104.432105283 seconds
    amazon-ebs: [2014-09-05T18:52:52+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: Chef::Exceptions::Exec: package[mysql-community-server] (/tmp/packer-chef-solo/cookbooks-0/mysql/libraries/provider_mysql_service_rhel.rb line 32) had an error: Chef::Exceptions::Exec:  returned 1, expected 0
    amazon-ebs: [2014-09-05T18:52:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

After chef-client failed, I checked yum.repo.d/

[ec2-user@ip-xxxxxxxxx ~]$ ls /etc/yum.repos.d/
amzn-main.repo     amzn-updates.repo  mysql55-community.repo
amzn-nosrc.repo    epel.repo
amzn-preview.repo  epel-testing.repo

Then I tried to install mysql-community-server manually "sudo yum install mysql-community-server". I got the following message.

Transaction check error:
  file /usr/lib64/mysql/libmysqlclient.so.18.0.0 from install of mysql-community-libs-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-libs-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/msql2mysql from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql_config from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql_find_rows from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql_waitpid from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlaccess from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqladmin from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlbinlog from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlcheck from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqldump from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlimport from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlshow from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlslap from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql_find_rows.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql_waitpid.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlaccess.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqladmin.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqldump.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlshow.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlslap.1.gz from install of mysql-community-client-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /etc/my.cnf from install of mysql-community-server-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-common-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/my_print_defaults from install of mysql-community-server-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/my_print_defaults.1.gz from install of mysql-community-server-5.5.39-5.el6.x86_64 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/msql2mysql from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql_config from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysql_find_rows from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/bin/mysqlaccess from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql_find_rows.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysql_waitpid.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlaccess.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqladmin.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqldump.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlshow.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64
  file /usr/share/man/man1/mysqlslap.1.gz from install of mysql-community-client-5.5.39-5.el6.i686 conflicts with file from package mysql55-5.5.38-1.0.amzn1.x86_64

Error Summary
-------------

Default Recipe Script failed on Centos 6.6

I have I am using cookbook 6.0.4 with Chef 12.0.3 on Chef Vragrant Centos 6.6 box. Virtual box version 4.3.
I run into the following problem using the example script from the README of this cookbook.

Chef will fail to execute command /sbin/service mysql-default start.
After vagrant ssh into the box, I can start 'sudo service mysql-default' with root user.

And I wonder if this is the cause, it has 'debian' but I am on centos:
==> default: 27: service "#{new_resource.name} :start #{mysql_name}" do
==> default: 28: service_name mysql_name
==> default: 29: provider Chef::Provider::Service::Init::Insserv if node['platform'] == 'debian'
==> default: 30: supports restart: true, status: true
==> default: 31: action [:enable, :start]
==> default: 32: end
==> default: 33: end
==> default:

PS C:\Users\bill\VMs\cheftest\myapp> vagrant provision
==> default: Loading Berkshelf datafile...
==> default: Sharing cookbooks with VM
==> default: Updating Vagrant's Berkshelf...
==> default: Resolving cookbook dependencies...
==> default: Fetching 'myapp' from source at .
==> default: Fetching cookbook index from https://supermarket.getchef.com...
==> default: Using apt (2.6.0)
==> default: Using apache2 (3.0.0)
==> default: Using hhvm (0.6.0)
==> default: Using iptables (0.14.0)
==> default: Using java (1.29.0)
==> default: Using logrotate (1.7.0)
==> default: Using myapp (0.1.0) from source at .
==> default: Using mysql (6.0.4)
==> default: Using rbac (1.0.2)
==> default: Using resource-control (0.1.1)
==> default: Using smf (2.2.1)
==> default: Using yum (3.5.1)
==> default: Using yum-mysql-community (0.1.11)
==> default: Vendoring apache2 (3.0.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz
8af-default/apache2
==> default: Vendoring apt (2.6.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8af-
default/apt
==> default: Vendoring hhvm (0.6.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8af
-default/hhvm
==> default: Vendoring iptables (0.14.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1b
dz8af-default/iptables
==> default: Vendoring java (1.29.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8a
f-default/java
==> default: Vendoring logrotate (1.7.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1b
dz8af-default/logrotate
==> default: Vendoring myapp (0.1.0) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8a
f-default/myapp
==> default: Vendoring mysql (6.0.4) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8a
f-default/mysql
==> default: Vendoring rbac (1.0.2) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8af
-default/rbac
==> default: Vendoring resource-control (0.1.1) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-
5244-1bdz8af-default/resource-control
==> default: Vendoring smf (2.2.1) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8af-
default/smf
==> default: Vendoring yum (3.5.1) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141223-5244-1bdz8af-
default/yum
==> default: Vendoring yum-mysql-community (0.1.11) to C:/Users/bill/.berkshelf/vagrant-berkshelf/shelves/berkshelf20141
223-5244-1bdz8af-default/yum-mysql-community
==> default: Chef 12.0.3 Omnibus package is already installed.
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: [2014-12-23T17:06:34+00:00] INFO: Forking chef instance to converge...
==> default: [2014-12-23T17:06:34+00:00] INFO: *** Chef 12.0.3 ***
==> default: [2014-12-23T17:06:34+00:00] INFO: Chef-client pid: 4105
==> default: [2014-12-23T17:06:37+00:00] INFO: Setting the run_list to ["recipe[myapp::default]"] from CLI options
==> default: [2014-12-23T17:06:37+00:00] INFO: Run List is [recipe[myapp::default]]
==> default: [2014-12-23T17:06:37+00:00] INFO: Run List expands to [myapp::default]
==> default: [2014-12-23T17:06:37+00:00] INFO: Starting Chef Run for myapp-berkshelf
==> default: [2014-12-23T17:06:37+00:00] INFO: Running start handlers
==> default: [2014-12-23T17:06:37+00:00] INFO: Start handlers complete.
==> default: [2014-12-23T17:06:39+00:00] INFO: Ignoring apache2::mod_authn_core. not available until apache 2.4
==> default: [2014-12-23T17:06:39+00:00] WARN: Cloning resource attributes for execute[a2dissite default.conf] from prio
r resource (CHEF-3694)
==> default: [2014-12-23T17:06:39+00:00] WARN: Previous execute[a2dissite default.conf]: /tmp/vagrant-chef-3/chef-solo-1
/cookbooks/apache2/definitions/apache_site.rb:35:in `block in from_file'
==> default: [2014-12-23T17:06:39+00:00] WARN: Current  execute[a2dissite default.conf]: /tmp/vagrant-chef-3/chef-solo-1
/cookbooks/apache2/definitions/apache_site.rb:35:in `block in from_file'
==> default: [2014-12-23T17:06:44+00:00] INFO: template[/etc/yum.repos.d/mysql57-community.repo] created file /etc/yum.r
epos.d/mysql57-community.repo
==> default: [2014-12-23T17:06:44+00:00] INFO: template[/etc/yum.repos.d/mysql57-community.repo] updated file contents /
etc/yum.repos.d/mysql57-community.repo
==> default: [2014-12-23T17:06:44+00:00] INFO: template[/etc/yum.repos.d/mysql57-community.repo] mode changed to 644
==> default: [2014-12-23T17:06:45+00:00] INFO: template[/etc/yum.repos.d/mysql57-community.repo] sending run action to e
xecute[yum-makecache-mysql57-community] (immediate)
==> default: [2014-12-23T17:06:47+00:00] INFO: execute[yum-makecache-mysql57-community] ran successfully
==> default: [2014-12-23T17:06:47+00:00] INFO: template[/etc/yum.repos.d/mysql57-community.repo] sending create action t
o ruby_block[yum-cache-reload-mysql57-community] (immediate)
==> default: [2014-12-23T17:06:47+00:00] INFO: ruby_block[yum-cache-reload-mysql57-community] called
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /etc/mysql-default] owner changed to 27
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /etc/mysql-default] group changed to 27
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] owner changed to 27
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /etc/mysql-default/conf.d] group changed to 27
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /var/run/mysql-default] owner changed to 27
==> default: [2014-12-23T17:06:51+00:00] INFO: directory[default :create /var/run/mysql-default] group changed to 27
==> default: [2014-12-23T17:06:52+00:00] INFO: directory[default :create /var/log/mysql-default] owner changed to 27
==> default: [2014-12-23T17:06:52+00:00] INFO: directory[default :create /var/log/mysql-default] group changed to 27
==> default: [2014-12-23T17:06:52+00:00] INFO: directory[default :create /var/lib/mysql-default] owner changed to 27
==> default: [2014-12-23T17:06:52+00:00] INFO: directory[default :create /var/lib/mysql-default] group changed to 27
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :create /etc/mysql-default/my.cnf] backed up to /var/che
f/backup/etc/mysql-default/my.cnf.chef-20141223170653.091418
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :create /etc/mysql-default/my.cnf] updated file contents
 /etc/mysql-default/my.cnf
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :create /etc/mysql-default/my.cnf] owner changed to 27
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :create /etc/mysql-default/my.cnf] group changed to 27
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :start /etc/init.d/mysql-default] backed up to /var/chef
/backup/etc/init.d/mysql-default.chef-20141223170653.511102
==> default: [2014-12-23T17:06:53+00:00] INFO: template[default :start /etc/init.d/mysql-default] updated file contents
/etc/init.d/mysql-default
==> default: ================================================================================
==> default: Error executing action `start` on resource 'service[default :start mysql-default]'
==> default: ================================================================================
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default:
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of /sbin/service mysql-default start ----
==> default: STDOUT: Starting MySQL instance mysql-default
==> default: Starting mysql-default:  [  OK  ]
==> default: STDERR:
==> default: ---- End output of /sbin/service mysql-default start ----
==> default: Ran /sbin/service mysql-default start returned 1
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_sysvinit.rb
==> default:
==> default:  27:           service "#{new_resource.name} :start #{mysql_name}" do
==> default:  28:             service_name mysql_name
==> default:  29:             provider Chef::Provider::Service::Init::Insserv if node['platform'] == 'debian'
==> default:  30:             supports restart: true, status: true
==> default:  31:             action [:enable, :start]
==> default:  32:           end
==> default:  33:         end
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_sysvinit.rb:
27:in `block in <class:Sysvinit>'
==> default:
==> default: service("default :start mysql-default") do
==> default:   action [:enable, :start]
==> default:   supports {:restart=>true, :status=>true}
==> default:   retries 0
==> default:   retry_delay 2
==> default:   default_guard_interpreter :default
==> default:   service_name "mysql-default"
==> default:   enabled true
==> default:   pattern "default :start mysql-default"
==> default:   declared_type :service
==> default:   cookbook_name :myapp
==> default: end
==> default:
==> default: [2014-12-23T17:07:24+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: ================================================================================
==> default: Error executing action `start` on resource 'mysql_service[default]'
==> default: ================================================================================
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: service[default :start mysql-default] (/tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_m
ysql_service_sysvinit.rb line 27) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0],
 but received '1'
==> default: ---- Begin output of /sbin/service mysql-default start ----
==> default: STDOUT: Starting MySQL instance mysql-default
==> default: Starting mysql-default:  [  OK  ]
==> default: STDERR:
==> default: ---- End output of /sbin/service mysql-default start ----
==> default: Ran /sbin/service mysql-default start returned 1
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/myapp/recipes/database.rb
==> default:
==> default:   1: mysql_service 'default' do
==> default:   2:   port '3306'
==> default:   3:   version '5.7'
==> default:   4:   initial_root_password 'change me'
==> default:   5:   action [:create, :start]
==> default:   6: end
==> default:   7:
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/myapp/recipes/database.rb:1:in `from_file'
==> default:
==> default: mysql_service("default") do
==> default:   action [:create, :start]
==> default:   updated true
==> default:   updated_by_last_action true
==> default:   retries 0
==> default:   retry_delay 2
==> default:   default_guard_interpreter :default
==> default:   declared_type :mysql_service
==> default:   cookbook_name :myapp
==> default:   recipe_name "database"
==> default:   port "3306"
==> default:   version "5.7"
==> default:   initial_root_password "change me"
==> default:   package_action :install
==> default:   instance "default"
==> default:   run_user "mysql"
==> default:   run_group "mysql"
==> default:   charset "utf8"
==> default: end
==> default: [2014-12-23T17:07:24+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: [2014-12-23T17:07:24+00:00] ERROR: Running exception handlers
==> default: [2014-12-23T17:07:24+00:00] ERROR: Exception handlers complete
==> default: [2014-12-23T17:07:24+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-12-23T17:07:25+00:00] ERROR: mysql_service[default] (myapp::database line 1) had an error: Mixlib::Sh
ellOut::ShellCommandFailed: service[default :start mysql-default] (/tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libra
ries/provider_mysql_service_sysvinit.rb line 27) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to
 exit with [0], but received '1'
==> default: ---- Begin output of /sbin/service mysql-default start ----
==> default: STDOUT: Starting MySQL instance mysql-default
==> default: Starting mysql-default:  [  OK  ]
==> default: STDERR:
==> default: ---- End output of /sbin/service mysql-default start ----
==> default: Ran /sbin/service mysql-default start returned 1
==> default: [2014-12-23T17:07:25+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessf
ully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
PS C:\Users\bill\VMs\cheftest\myapp> vagrant ssh
Last login: Tue Dec 23 16:53:23 2014 from 10.0.2.2
[vagrant@myapp-berkshelf ~]$ sudo service mysql-default status
mysql-default is not running
[vagrant@myapp-berkshelf ~]$ sudo service mysql-default start
Starting MySQL instance mysql-default

Starting mysql-default:                                    [  OK  ]
[vagrant@myapp-berkshelf ~]$
[vagrant@myapp-berkshelf ~]$

Does not work on Ubuntu 14.04

This is how I'm using the recipe:

node.set['mysql']['server_root_password'] = 'yolo'

include_recipe 'mysql::server'

template '/etc/mysql/conf.d/mysite.cnf' do
  owner 'mysql'      
  source 'mysite.cnf.erb'
  #notifies :restart, 'mysql_service[default]'
end

I am getting this output:

Chef::Exceptions::FileNotFound

Cookbook 'mysql' (4.0.14) does not contain a file at any of these locations:
templates/ubuntu-14.04/init-mysql.conf.erb
templates/ubuntu/init-mysql.conf.erb
templates/default/init-mysql.conf.erb

This cookbook does contain: ['debian.cnf.erb','grants.sql.erb','my.cnf.erb','mysql-server.seed.erb','port_mysql.erb','usr.sbin.mysqld.erb','init-mysql.conf.erb','init-mysql.conf.erb','my.ini.erb']

Resource Declaration:

In /var/chef/cache/cookbooks/mysql/recipes/_server_debian.rb

77: template '/etc/init/mysql.conf' do
78: source 'init-mysql.conf.erb'
79: end
80:

Compiled Resource:

Declared in /var/chef/cache/cookbooks/mysql/recipes/_server_debian.rb:77:in `from_file'

template("/etc/init/mysql.conf") do
provider Chef::Provider::Template
action "create"
retries 0
retry_delay 2
path "/etc/init/mysql.conf"
backup 5
atomic_update true
source "init-mysql.conf.erb"
cookbook_name "mysql"
recipe_name "_server_debian"
end

Anyone else having these issues?

MySQL Server not starting on reboot (6.0) (Ubuntu 14.04)

Looks like something is wrong with the upstart script. This should be easily reproducible.

My recipe:

mysql_client 'default' do
  version '5.6'
end

mysql_service 'default' do
  port '3306'
  version '5.6'
  initial_root_password 'password'
  action [:create, :start]
end

After successfully converging, I try rebooting. MySQL no longer seems accessible...

$ mysql -h 127.0.0.1
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

Is the server running?

$ sudo service mysql-default status
mysql-default stop/waiting

Can I start it manually? Nope.. just sits here forever

$ sudo service mysql-default start

If I provision after reboot...

$ vagrant provision
...
==> default: [2014-12-16T21:16:02+00:00] INFO: directory[default :create /run/mysql-default] created directory /run/mysql-default
==> default: [2014-12-16T21:16:02+00:00] INFO: directory[default :create /run/mysql-default] owner changed to 106
==> default: [2014-12-16T21:16:02+00:00] INFO: directory[default :create /run/mysql-default] group changed to 114
==> default: [2014-12-16T21:16:02+00:00] INFO: directory[default :create /run/mysql-default] mode changed to 755
==> default: [2014-12-16T21:16:27+00:00] INFO: service[default :start mysql-default] started
==> default: [2014-12-16T21:16:27+00:00] INFO: Chef Run complete in 27.988659866 seconds

Client fails to install on Ubuntu 14.04 when selecting version 5.6 and using Server recipe

Basically if you use the mysql::server recipe on a Ubuntu 14.04 instance and you want to install the mysql::client recipe chef will fail because there's a package conflict.

Ubuntu 14.04 defaults to mysql 5.5 but if you want to install 5.6 then you need to specify the package which is what the server recipe does by installing mysql-server-5.6 but when it comes to the client recipe it will always try to install mysql-client which then causes a dependancy conflict in APT.

the lines that brings this issue is https://github.com/opscode-cookbooks/mysql/blob/master/libraries/provider_mysql_client_ubuntu.rb#L25

If you change the file to install mysql-client-5.6 chef will run correctly but I'm unsure how to make this work dynamically in the cookbook.

Automatic testing

Hi,
This question is partly because I'm setting up automatic chef testing too, and can't figure out your workflow.

It seems you only run rubocop and chefspec through travis, why no foodcritic or kitchen tests there?
Also, the guard does user all tests except kitchen, is this purely because kitchen takes too long?

The division in the Gemfile with lint and unit doesn't seem used and where does the --without kitchen_vagrant with bundler come into play?

Thanks

mysql::server recipe error

My node is Ubuntu 14.04

My run-list is this

knife[:run_list]    =     "recipe[apache2]", "recipe[mysql::server]", "recipe[php]"

And I changed default.rb to the following

#
default['mysql']['service_name'] = 'default'
default['mysql']['version'] = '5.5'   # I tried both 5.5 and 5.6 #

# passwords
default['mysql']['server_root_password'] = '123456'
default['mysql']['server_debian_password'] = '5501466'
default['mysql']['server_repl_password'] = nil

# used in grants.sql
default['mysql']['allow_remote_root'] = false
default['mysql']['remove_anonymous_users'] = true
default['mysql']['root_network_acl'] = nil

case node['platform']
when 'smartos'
  default['mysql']['data_dir'] = '/opt/local/lib/mysql'
else
  default['mysql']['data_dir'] = '/var/lib/mysql'
end

# port
default['mysql']['port'] = '3306'

# server package version and action
default['mysql']['server_package_version'] = nil
default['mysql']['server_package_action'] = 'install'
default['mysql']['enable_utf8'] = 'true'

Here's the error log when I bootstrap the node

172.28.128.3 Recipe: mysql::server
172.28.128.3   * mysql_service[default] action createRecipe: <Dynamically Defined Resource>
172.28.128.3   * package[debconf-utils] action install (up to date)
172.28.128.3   * directory[/var/cache/local/preseeding] action create (up to date)
172.28.128.3   * template[/var/cache/local/preseeding/mysql-server.seed] action create (up to date)
172.28.128.3   * execute[preseed mysql-server] action nothing (skipped due to action :nothing)
172.28.128.3   * package[mysql-server-5.5] action install
172.28.128.3 ================================================================================
172.28.128.3 Error executing action `install` on resource 'package[mysql-server-5.5]'
172.28.128.3 ================================================================================
172.28.128.3
172.28.128.3
172.28.128.3 Mixlib::ShellOut::ShellCommandFailed
172.28.128.3 ------------------------------------
172.28.128.3 Expected process to exit with [0], but received '100'
172.28.128.3 ---- Begin output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 STDOUT: Reading package lists...
172.28.128.3 Building dependency tree...
172.28.128.3 Reading state information...
172.28.128.3 The following extra packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-core-5.5
172.28.128.3 Suggested packages:
172.28.128.3   libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
172.28.128.3   libsql-statement-perl libipc-sharedcache-perl tinyca mailx
172.28.128.3 The following NEW packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-5.5 mysql-server-core-5.5
172.28.128.3 0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
172.28.128.3 Need to get 7936 kB/9014 kB of archives.
172.28.128.3 After this operation, 96.4 MB of additional disk space will be used.
172.28.128.3 Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.24 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 STDERR: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-common_5.5.37-0ubuntu0.14.04.1_all.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
172.28.128.3 ---- End output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 Ran apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 returned 100
172.28.128.3
172.28.128.3
172.28.128.3 Resource Declaration:
172.28.128.3 ---------------------
172.28.128.3 # In /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb
172.28.128.3
172.28.128.3  55:           package new_resource.parsed_package_name do
172.28.128.3  56:             action new_resource.parsed_package_action
172.28.128.3  57:             version new_resource.parsed_package_version
172.28.128.3  58:           end
172.28.128.3  59:
172.28.128.3
172.28.128.3
172.28.128.3
172.28.128.3 Compiled Resource:
172.28.128.3 ------------------
172.28.128.3 # Declared in /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:55:in `block in <class:Ubuntu>'
172.28.128.3
172.28.128.3 package("mysql-server-5.5") do
172.28.128.3   action [:install]
172.28.128.3   retries 0
172.28.128.3   retry_delay 2
172.28.128.3   package_name "mysql-server-5.5"
172.28.128.3   version "5.5.37-0ubuntu0.14.04.1"
172.28.128.3   cookbook_name "mysql"
172.28.128.3 end
172.28.128.3
172.28.128.3
172.28.128.3
172.28.128.3
172.28.128.3 ================================================================================
172.28.128.3 Error executing action `create` on resource 'mysql_service[default]'
172.28.128.3 ================================================================================
172.28.128.3
172.28.128.3
172.28.128.3 Mixlib::ShellOut::ShellCommandFailed
172.28.128.3 ------------------------------------
172.28.128.3 package[mysql-server-5.5] (/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
172.28.128.3 ---- Begin output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 STDOUT: Reading package lists...
172.28.128.3 Building dependency tree...
172.28.128.3 Reading state information...
172.28.128.3 The following extra packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-core-5.5
172.28.128.3 Suggested packages:
172.28.128.3   libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
172.28.128.3   libsql-statement-perl libipc-sharedcache-perl tinyca mailx
172.28.128.3 The following NEW packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-5.5 mysql-server-core-5.5
172.28.128.3 0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
172.28.128.3 Need to get 7936 kB/9014 kB of archives.
172.28.128.3 After this operation, 96.4 MB of additional disk space will be used.
172.28.128.3 Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.24 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 STDERR: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-common_5.5.37-0ubuntu0.14.04.1_all.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
172.28.128.3 ---- End output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 Ran apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 returned 100
172.28.128.3
172.28.128.3
172.28.128.3 Resource Declaration:
172.28.128.3 ---------------------
172.28.128.3 # In /var/chef/cache/cookbooks/mysql/recipes/server.rb
172.28.128.3
172.28.128.3  20: mysql_service node['mysql']['service_name'] do
172.28.128.3  21:   version node['mysql']['version']
172.28.128.3  22:   port node['mysql']['port']
172.28.128.3  23:   data_dir node['mysql']['data_dir']
172.28.128.3  24:   server_root_password node['mysql']['server_root_password']
172.28.128.3  25:   server_debian_password node['mysql']['server_debian_password']
172.28.128.3  26:   server_repl_password node['mysql']['server_repl_password']
172.28.128.3  27:   allow_remote_root node['mysql']['allow_remote_root']
172.28.128.3  28:   remove_anonymous_users node['mysql']['remove_anonymous_users']
172.28.128.3  29:   remove_test_database node['mysql']['remove_test_database']
172.28.128.3  30:   root_network_acl node['mysql']['root_network_acl']
172.28.128.3  31:   package_version node['mysql']['server_package_version']
172.28.128.3  32:   package_action node['mysql']['server_package_action']
172.28.128.3  33:   enable_utf8 node['mysql']['enable_utf8']
172.28.128.3  34:   action :create
172.28.128.3  35: end
172.28.128.3
172.28.128.3
172.28.128.3
172.28.128.3 Compiled Resource:
172.28.128.3 ------------------
172.28.128.3 # Declared in /var/chef/cache/cookbooks/mysql/recipes/server.rb:20:in `from_file'
172.28.128.3
172.28.128.3 mysql_service("default") do
172.28.128.3   action [:create]
172.28.128.3   retries 0
172.28.128.3   retry_delay 2
172.28.128.3   cookbook_name "mysql"
172.28.128.3   recipe_name "server"
172.28.128.3   version "5.5"
172.28.128.3   port "3306"
172.28.128.3   data_dir "/var/lib/mysql"
172.28.128.3   server_root_password "123456"
172.28.128.3   server_debian_password "5501466"
172.28.128.3   remove_anonymous_users true
172.28.128.3   remove_test_database true
172.28.128.3   package_action "install"
172.28.128.3   enable_utf8 "true"
172.28.128.3 end
172.28.128.3
172.28.128.3
172.28.128.3
172.28.128.3 [2014-11-16T08:45:13+00:00] ERROR: Running exception handlers
172.28.128.3 [2014-11-16T08:45:13+00:00] ERROR: Exception handlers complete
172.28.128.3 [2014-11-16T08:45:13+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
172.28.128.3 Chef Client failed. 3 resources updated
172.28.128.3 [2014-11-16T08:45:16+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: package[mysql-server-5.5] (/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
172.28.128.3 ---- Begin output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 STDOUT: Reading package lists...
172.28.128.3 Building dependency tree...
172.28.128.3 Reading state information...
172.28.128.3 The following extra packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-core-5.5
172.28.128.3 Suggested packages:
172.28.128.3   libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
172.28.128.3   libsql-statement-perl libipc-sharedcache-perl tinyca mailx
172.28.128.3 The following NEW packages will be installed:
172.28.128.3   libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
172.28.128.3   libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
172.28.128.3   mysql-server-5.5 mysql-server-core-5.5
172.28.128.3 0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
172.28.128.3 Need to get 7936 kB/9014 kB of archives.
172.28.128.3 After this operation, 96.4 MB of additional disk space will be used.
172.28.128.3 Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.24 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-common all 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-client-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-core-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 Err http://security.ubuntu.com/ubuntu/ trusty-security/main mysql-server-5.5 amd64 5.5.37-0ubuntu0.14.04.1
172.28.128.3   404  Not Found [IP: 91.189.91.23 80]
172.28.128.3 STDERR: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-common_5.5.37-0ubuntu0.14.04.1_all.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-client-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-core-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/mysql-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb  404  Not Found [IP: 91.189.91.23 80]
172.28.128.3
172.28.128.3 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
172.28.128.3 ---- End output of apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 ----
172.28.128.3 Ran apt-get -q -y install mysql-server-5.5=5.5.37-0ubuntu0.14.04.1 returned 100
172.28.128.3 [2014-11-16T08:45:16+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

RHEL7 support is not working

There is no RHEL7 "mysql" package offered by RH, so Chef obviously fails on mysql::client on RHEL7 due to the packages hardcoded in https://github.com/opscode-cookbooks/mysql/blob/master/libraries/provider_mysql_client_rhel.rb

However, check this out. Via root shell, yum install mysql picks mariadb ... but package "mysql" fails.

# yum install mysql
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.37-1.el7_0 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package              Arch                Version                       Repository                       Size
==============================================================================================================
Installing:
 mariadb              x86_64              1:5.5.37-1.el7_0              rhel-7-server-rpms              9.0 M

Transaction Summary
==============================================================================================================
Install  1 Package
...
# chef-apply -e 'package "mysql"'

Chef::Exceptions::Package
-------------------------
No version specified, and no candidate version available for mysql
...
Compiled Resource:
------------------
# Declared in /tmp/recipe-temporary-file20140923-26200-16cdxk4:1:in `run_chef_recipe'

package("mysql") do
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "mysql"
  cookbook_name "(chef-apply cookbook)"
  recipe_name "(chef-apply recipe)"
end

MySQL 5.6 server installation fails on amazon linux

Hi,

I'm using this cookbook to install MySQL 5.6 on Amazon linux 2014.03. Setting a root password fails with the following output:

* execute[assign-root-password] action run       [2014-11-26T10:10:35+00:00] INFO: Processing execute[assign-root-password] action run (/tmp/kitchen/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb line 138)
ERROR 1045 (28000)       : Access denied for user 'root'@'localhost' (using password: YES)
 (skipped due to only_if)       
       [2014-11-26T10:10:35+00:00] DEBUG: Skipping execute[assign-root-password] due to only_if command `/usr/bin/mysql -u root -e 'show databases;'`

And since the root password is not set, following actions fail accordingly:

 execute[install-grants] action run       [2014-11-26T10:10:35+00:00] INFO: Processing execute[install-grants] action run (/tmp/kitchen/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb line 91)
       Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000)       : Access denied for user 'root'@'localhost' (using password: YES)    ===============================================================================
      Error executing action `run` on resource 'execute[install-grants]'       
=============================================================================== 

      Mixlib::ShellOut::ShellCommandFailed       
      ------------------------------------       
             Expected process to exit with [0], but received '1'       
             ---- Begin output of /usr/bin/mysql -u root -proot < /etc/mysql_grants.sql ----
             STDOUT: 
             STDERR: Warning: Using a password on the command line interface can be insecure.
             ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
             ---- End output of /usr/bin/mysql -u root -proot < /etc/mysql_grants.sql ----
      Ran /usr/bin/mysql -u root -proot < /etc/mysql_grants.sql returned 1       
      Resource Declaration:       
      ---------------------       
      suppressed sensitive resource output       

      Compiled Resource:       
      ------------------       
      suppressed sensitive resource output  

Feedback welcome.

service_mysql restart action not restarting

Using mysql-multi cookbook I've found that after deploying a master server, it finishes installing every template but server is not restarted.
Trying to find a solution, I realized that if I modify restart action provided by provider_service_mysql_ubuntu.rb to something similar to:

      action :restart do
        service 'mysql' do
          provider Chef::Provider::Service::Upstart
          supports :restart => true 
          action :restart
        end.run_action(:restart)
      end  

Server finally got restarted.

Someone has a similar problem? Am I using wrong mysql_service LWRP?

Thanks in advance

Security risk with the mysql root password

I think the .mysql_root file (that contains the actual mysql_root_password) should be removed upon completion of the recipe.

It poses a security risk for whenever the server might be kind of compromised.

Code that i'm speaking of is at file libraries/provider_mysql_service_ubuntu.rb
Lines 181 --> 188

          execute 'create root marker' do
            cmd = '/bin/echo'
            cmd << " '#{Shellwords.escape(new_resource.parsed_server_root_password)}'"
            cmd << ' > /etc/.mysql_root'
            cmd << ' ;/bin/chmod 0600 /etc/.mysql_root'
            command cmd
            action :nothing
          end

Add SUSE(sles) support (re-open COOK-2515)

Reopened -> COOK-2515

I did some work trying to get this cookbook to work on sles 11.3.
I tried to reuse the provider_mysql_service_rhel.rb to satisfy sles like so: https://gist.github.com/hagzag/7f7f7c6125d688959fe5

The client was less complicated (IMO) -> adding provider_mysql_client_suse.rb see: https://gist.github.com/hagzag/78f78ac72bedf541ab23

I also modified the helpers library to support suse -> adding lines 51-52:

when platform_family == 'suse'
            platform_version.to_s

and 237-244:

'suse' => {
              'default_data_dir' => '/var/lib/mysql',
              'default_version' => '5.5',
              '11.3' => {
                  'package_name' => 'mysql',
                  'service_name' => 'mysql'
              }
          }

BTW I tried 11 & 11.3 considering the to_i.to_s methods translate 11.3 to 11.
What am I missing ? how can I help push SLES support forward ?

Getting error "Mysql is not a class"

Using it with the database cookbook. Getting the following error with a script that works fine with v5.3.6.

==> default: ================================================================================
==> default: Error executing action `create` on resource 'mysql_database[databasename]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: TypeError
==> default: ---------
==> default: Mysql is not a class
==> default: 
==> default: 
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/database/libraries/provider_database_mysql.rb:29:in `load_current_resource'
==> default: 
==> default: 
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/appserver/recipes/dbserver.rb
==> default: 
==> default: 
==> default: 
==> default:  53:     mysql_database db['database'] do
==> default: 
==> default:  54:       connection mysql_connection
==> default: 
==> default:  55:       action :create
==> default: 
==> default:  56:     end
==> default: 
==> default:  57: 
==> default: 
==> default: 
==> default: 
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/appserver/recipes/dbserver.rb:53:in `block in from_file'
==> default: 
==> default: 
==> default: 
==> default: mysql_database("databasename") do
==> default: 
==> default:   provider Chef::Provider::Database::Mysql
==> default: 
==> default:   action [:create]
==> default: 
==> default:   retries 0
==> default: 
==> default:   retry_delay 2
==> default: 
==> default:   guard_interpreter :default
==> default: 
==> default:   database_name "databasename"
==> default: 
==> default:   cookbook_name :appserver
==> default: 
==> default:   recipe_name "dbserver"
==> default: 
==> default:   connection {:host=>"localhost", :username=>"root", :password=>"XXXXXXXXX"}
==> default: 
==> default: end

Setting innodb_log_file_size to custom value in cnf file result in MySQL server not able to restart

The problem happens when you create a new MySQL server using the cookbook, then by default it will create an ib_logfile0 and ib_logfile1 file of 5Mb. If an additional cnf file has specified innodb_log_file_size then MySQL will not be able to restart because the value in cnf file does not match the files on disk.

2014-09-22_03:01:16.08395 INFO: Processing service[mysql] action restart (/var/chef/git/tmp/librarian/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 196)
2014-09-22_03:01:19.50757
2014-09-22_03:01:19.50767 ================================================================================
2014-09-22_03:01:19.50772 Error executing action `restart` on resource 'service[mysql]'
2014-09-22_03:01:19.50777 ================================================================================
2014-09-22_03:01:19.50781
2014-09-22_03:01:19.50782 Chef::Exceptions::Exec
2014-09-22_03:01:19.50792 ----------------------
2014-09-22_03:01:19.50797 /sbin/restart mysql returned 1, expected 0
2014-09-22_03:01:19.50803
2014-09-22_03:01:19.50805 Resource Declaration:
2014-09-22_03:01:19.50819 ---------------------
2014-09-22_03:01:19.50825 # In /var/chef/git/tmp/librarian/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb
2014-09-22_03:01:19.50827
2014-09-22_03:01:19.50828 196:             service 'mysql' do
2014-09-22_03:01:19.50830 197:               provider Chef::Provider::Service::Upstart
2014-09-22_03:01:19.50831 198:               supports :restart => true
2014-09-22_03:01:19.50834 199:               action :restart
2014-09-22_03:01:19.50836 200:             end
2014-09-22_03:01:19.50838 201:           end
2014-09-22_03:01:19.50843
2014-09-22_03:01:19.50845 Compiled Resource:
2014-09-22_03:01:19.50854 ------------------
2014-09-22_03:01:19.50855 # Declared in /var/chef/git/tmp/librarian/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:196:in `block (2 levels) in <class:Ubuntu>'
2014-09-22_03:01:19.50856
2014-09-22_03:01:19.50857 service("mysql") do
2014-09-22_03:01:19.50859   provider Chef::Provider::Service::Upstart
2014-09-22_03:01:19.50860   action [:restart]
2014-09-22_03:01:19.50861   supports {:restart=>true}
2014-09-22_03:01:19.50862   retries 0
2014-09-22_03:01:19.50864   retry_delay 2
2014-09-22_03:01:19.50865   guard_interpreter :default
2014-09-22_03:01:19.50866   service_name "mysql"
2014-09-22_03:01:19.50867   pattern "mysql"
2014-09-22_03:01:19.50868   cookbook_name :mysql
2014-09-22_03:01:19.50869 end
2014-09-22_03:01:19.50870
2014-09-22_03:01:19.50875 INFO: Running queued delayed notifications before re-raising exception
2014-09-22_03:01:19.50991
2014-09-22_03:01:19.50993 ================================================================================
2014-09-22_03:01:19.50998 Error executing action `restart` on resource 'mysql_service[default]'
2014-09-22_03:01:19.51003 ================================================================================
2014-09-22_03:01:19.51007
2014-09-22_03:01:19.51008 Chef::Exceptions::Exec
2014-09-22_03:01:19.51016 ----------------------
2014-09-22_03:01:19.51020 service[mysql] (/var/chef/git/tmp/librarian/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 196) had an error: Chef::Exceptions::Exec: /sbin/restart mysql returned 1, expected 0
2014-09-22_03:01:19.51025
2014-09-22_03:01:19.51026 Resource Declaration:
2014-09-22_03:01:19.51034 ---------------------
2014-09-22_03:01:19.51038 # In /var/chef/git/tmp/librarian/cookbooks/mysql/recipes/server.rb
2014-09-22_03:01:19.51040
2014-09-22_03:01:19.51042  20: mysql_service node['mysql']['service_name'] do
2014-09-22_03:01:19.51044  21:   version node['mysql']['version']
2014-09-22_03:01:19.51044  22:   port node['mysql']['port']
2014-09-22_03:01:19.51046  23:   data_dir node['mysql']['data_dir']
2014-09-22_03:01:19.51047  24:   server_root_password node['mysql']['server_root_password']
2014-09-22_03:01:19.51047  25:   server_debian_password node['mysql']['server_debian_password']
2014-09-22_03:01:19.51049  26:   server_repl_password node['mysql']['server_repl_password']
2014-09-22_03:01:19.51049  27:   allow_remote_root node['mysql']['allow_remote_root']
2014-09-22_03:01:19.51051  28:   remove_anonymous_users node['mysql']['remove_anonymous_users']
2014-09-22_03:01:19.51052  29:   remove_test_database node['mysql']['remove_test_database']
2014-09-22_03:01:19.51053  30:   root_network_acl node['mysql']['root_network_acl']
2014-09-22_03:01:19.51054  31:   version node['mysql']['version']
2014-09-22_03:01:19.51054  32:   action :create
2014-09-22_03:01:19.51056  33: end
[snip]
2014-09-22_03:01:20.82157 FATAL: Chef::Exceptions::Exec: mysql_service[default] (mysql::server line 20) had an error: Chef::Exceptions::Exec: service[mysql] (/var/chef/git/tmp/librarian/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb line 196) had an error: Chef::Exceptions::Exec: /sbin/restart mysql returned 1, expected 0

Trying to start MySQL manually:

/var/lib/mysql# mysqld --verbose
140922  3:02:32 [Note] Plugin 'FEDERATED' is disabled.
140922  3:02:32 InnoDB: The InnoDB memory heap is disabled
140922  3:02:32 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140922  3:02:32 InnoDB: Compressed tables use zlib 1.2.3.4
140922  3:02:32 InnoDB: Initializing buffer pool, size = 4.0G
140922  3:02:32 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!
140922  3:02:32 [ERROR] Plugin 'InnoDB' init function returned error.
140922  3:02:32 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140922  3:02:32 [ERROR] Unknown/unsupported storage engine: InnoDB
140922  3:02:32 [ERROR] Aborting

Does this cookbook still support Windows

Hi

I've seen a lot of references to Windows in previous tickets and bugfixes, but the current version of the code does not seem to mention Windows (except in the Changelog, which references a previous version). Windows no longer seems to be listed in the Platforms file.

Is Windows currently supported by the cookbook? If not, are there other methods to install MySQL server with Chef?

Thanks

Tom

customize charset and collation in my.cnf

I see that we can specify the charset and collation for deprecated mysql version(see templates/default/deprecated/my.cnf.erb)
But its not possible to set up custom collation and charset for 5.5 or 5.6 version.
Is it indented? Is there a way to specify charset and collation?

Error for new version 5.5.4

The error log:

[2014-10-08T04:13:38+00:00] INFO: Processing mysql_service[default] action create (mysql::server line 20)
==> app: 
==> app: ================================================================================
==> app: Error executing action `create` on resource 'mysql_service[default]'
==> app: ================================================================================
==> app: 
==> app: 
==> app: NoMethodError
==> app: -------------
==> app: No resource or method named `execute' for `Chef::Provider::MysqlService::Ubuntu "none"'
==> app: 
==> app: 
==> app: Cookbook Trace:
==> app: ---------------
==> app: 
==> app: /var/vagrant-chef/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb:60:in `block in <class:Ubuntu>'
==> app: 
==> app: 
==> app: Resource Declaration:
==> app: ---------------------
==> app: # In /var/vagrant-chef/chef-solo-1/cookbooks/mysql/recipes/server.rb
==> app: 
==> app:  20: mysql_service node['mysql']['service_name'] do
==> app:  21:   version node['mysql']['version']
==> app:  22:   port node['mysql']['port']
==> app:  23:   data_dir node['mysql']['data_dir']
==> app:  24:   server_root_password node['mysql']['server_root_password']
==> app:  25:   server_debian_password node['mysql']['server_debian_password']
==> app:  26:   server_repl_password node['mysql']['server_repl_password']
==> app:  27:   allow_remote_root node['mysql']['allow_remote_root']
==> app:  28:   remove_anonymous_users node['mysql']['remove_anonymous_users']
==> app:  29:   remove_test_database node['mysql']['remove_test_database']
==> app:  30:   root_network_acl node['mysql']['root_network_acl']
==> app:  31:   package_version node['mysql']['server_package_version']
==> app:  32:   package_action node['mysql']['server_package_action']
==> app:  33:   action :create
==> app:  34: end
==> app: 
==> app: 
==> app: 
==> app: Compiled Resource:
==> app: ------------------
==> app: # Declared in /var/vagrant-chef/chef-solo-1/cookbooks/mysql/recipes/server.rb:20:in `from_file'
==> app: 
==> app: mysql_service("default") do
==> app:   action [:create]
==> app:   retries 0
==> app:   retry_delay 2
==> app:   cookbook_name :mysql
==> app:   recipe_name "server"
==> app:   port "3306"
==> app:   data_dir "/var/lib/mysql"
==> app:   server_root_password "serverrootpassword"
==> app:   server_debian_password "gnuslashlinux4ev4r"
==> app:   remove_anonymous_users true
==> app:   remove_test_database true
==> app:   package_action "install"
==> app: end
==> app: 
==> app: 
==> app: 
==> app: [2014-10-08T04:13:38+00:00] INFO: Running queued delayed notifications before re-raising exception
==> app: [2014-10-08T04:13:38+00:00] ERROR: Running exception handlers
==> app: [2014-10-08T04:13:38+00:00] ERROR: Exception handlers complete
==> app: [2014-10-08T04:13:38+00:00] FATAL: Stacktrace dumped to /vagrant/.vagrant/file_cache_path/chef-stacktrace.out
==> app: [2014-10-08T04:13:38+00:00] ERROR: mysql_service[default] (mysql::server line 20) had an error: NoMethodError: No resource or method named `execute' for `Chef::Provider::MysqlService::Ubuntu "none"'
==> app: [2014-10-08T04:13:38+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

It's on vagrant box ubuntu/trusty64

Hardcoded mysql-client package name prevents support for 5.6

Hi,
I'm using Centos 6.5 as an example.
If I change node['mysql']['version'] to let's say 5.6. When I call mysql_service it will install mysql-community-server, which will automatically install mysql-community-client.

If in the same run_list I add mysql_client it will try to install the hardcoded mysql . However it might fail because it's conflicting with mysql-community-client.

By example on Centos you will have

  • an error :
Transaction Check Error:
  file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package mysql-community-common-5.6.21-2.el6.x86_64
  file /usr/share/mysql/charsets/armscii8.xml from install of mysql-libs-5.1.73-3.el6_5.x86_64 conflicts with file from package mysql-community-common-5.6.21-2.el6.x86_64
  file /usr/share/mysql/charsets/ascii.xml from

Or

  • a success :
    Package mysql-5.1.73-3.el6_5.x86_64 is obsoleted by mysql-community-client-5.6.21-2.el6.x86_64 which is already installed <= returns 0. If obsoletes=1 is set in your yum.conf

On ubuntu 14, it will install mysql-client5.5 which will break mysql-server-5.6 :

# dpkg -l | grep -i mysql
ii  libdbd-mysql-perl                   4.025-1                       amd64        Perl5 database interface to the MySQL database
ii  libmysqlclient-dev                  5.5.40-0ubuntu0.14.04.1       amd64        MySQL database development files
ii  libmysqlclient18:amd64              5.5.40-0ubuntu0.14.04.1       amd64        MySQL database client library
ii  mysql-client-5.5                    5.5.40-0ubuntu0.14.04.1       amd64        MySQL database client binaries
ii  mysql-client-core-5.5               5.5.40-0ubuntu0.14.04.1       amd64        MySQL database core client binaries
ii  mysql-common                        5.5.40-0ubuntu0.14.04.1       all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-common-5.6                    5.6.19-0ubuntu0.14.04.1       all          MySQL 5.6 specific common files, e.g. /etc/mysql/conf.d/my-5.6.cnf
rc  mysql-server-5.6                    5.6.19-0ubuntu0.14.04.1       amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.6               5.6.19-0ubuntu0.14.04.1       amd64        MySQL database server binaries

I'm not adding mysql_client to my run_list it's done automatically by https://github.com/opscode-cookbooks/database => https://github.com/opscode-cookbooks/mysql-chef_gem/blob/master/libraries/provider_mysql_chef_gem.rb#L17

do you think we could have the same logic than https://github.com/opscode-cookbooks/mysql/blob/master/libraries/helpers.rb#L65-L67 for the client package name?

unable to update root's password

the cookbook updates the mysql_grants.sql script with the new password and tries to run the sql with the new password, and fails because the password hasn't been changed.

update sql to new:

- update content in file /etc/mysql_grants.sql from 66ad13 to f17e62
        --- /etc/mysql_grants.sql   2014-06-17 12:19:48.000000000 -0400
        +++ /tmp/chef-rendered-template20140617-6040-12vl87g    2014-06-17 12:22:13.000000000 -0400
        @@ -1,8 +1,8 @@
         DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
        -UPDATE mysql.user SET Password=PASSWORD('mypassword') WHERE User='root';
        +UPDATE mysql.user SET Password=PASSWORD('hello') WHERE User='root';
         DELETE FROM mysql.user WHERE User='';
         DROP DATABASE IF EXISTS test;
         DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
        -SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypassword');
        -SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('mypassword');
        +SET PASSWORD FOR 'root'@'localhost' = PASSWORD('hello');
        +SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('hello');

and fails to execute the script:

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/mysql -u root -phello < /etc/mysql_grants.sql ----
STDOUT:
STDERR: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
---- End output of /usr/bin/mysql -u root -phello < /etc/mysql_grants.sql ----
Ran /usr/bin/mysql -u root -phello < /etc/mysql_grants.sql returned 1


Resource Declaration:
---------------------
 In /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb

170:             execute 'install-grants' do
171:               cmd = "#{prefix_dir}/bin/mysql"
172:               cmd << ' -u root '
173:               cmd << "#{pass_string} < /etc/mysql_grants.sql"
174:               command cmd
175:               action :nothing
176:             end

Mysql server install fails on Debian Wheezy

I am using the wrapper cookbook :

node.set['mysql']['server_root_password'] = 'vagrant'
node.set['mysql']['port'] = '3308'
node.set['mysql']['data_dir'] = '/data'

include_recipe 'mysql::server'

And this is what i get when i run vagrant up:

==> default: [2014-08-23T20:45:30+02:00] INFO: execute[preseed mysql-server] ran successfully
==> default: 
==> default: ================================================================================
==> default: Error executing action `install` on resource 'package[mysql-server-5.5]'
==> default: ================================================================================
==> default: 
==> default: 
==> default: Chef::Exceptions::Exec
==> default: ----------------------
==> default: apt-get -q -y install mysql-server-5.5=5.5.38-0+wheezy1 returned 100, expected 0
==> default: 
==> default: 
==> default: Resource Declaration:
==> default: 
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/libraries/provider_mysql_service_debian.rb
==> default: 
==> default:  54:             package new_resource.package_name do
==> default:  55:               action :install
==> default:  56:             end
==> default:  57: 
==> default: 
==> default: 
==> default: 

Informations about the distro :

$ lsb_release --all
Distributor ID: Debian
Description:    Debian GNU/Linux 7.1 (wheezy)
Release:    7.1
Codename:   wheezy

Error if used mysql command

command: mysql -u root -pPassword
-> Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

command: sudo service mysql-default status
-> mysql-default start/running, process 15787

Ubuntu 14.04

Config:
mysql_service 'default' do
port '3306'
version '5.6'
initial_root_password 'change_me'
action [:create, :start]
end

mysql_client 'default' do
version '5.6'
action :create
end

Bring back random root password when not specified

As it was proposed in the version 4 (and can still be found in the postgres cookbook for example), it would be nice to bring back the ramdomly generated SQL password for root account when nothing is specified in attributes.
This is a very nice feature which (IMO) & it helps (and force) dev & ops to learn & use "mysql admin" good practices.

Also, why did it was removed :-( ?

service will not restart after adding site specific configuration

After adding a site specific configuration for mysql as per the README of this cookbook the service is not restarted because it thinks nothing has changed.

Some output:

localhost   * cookbook_file[/etc/mysql/conf.d/mysqld_tuning.cnf] action create
localhost
localhost
localhost     - update content in file /etc/mysql/conf.d/mysqld_tuning.cnf from e3b0c4 to 53381c

<snip>

Recipe: mysql::server
localhost
localhost   * mysql_service[default] action restart
localhost  (up to date)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.