首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mysql厨师食谱忽略了我的初始根密码

mysql厨师食谱忽略了我的初始根密码
EN

Stack Overflow用户
提问于 2015-01-16 09:27:11
回答 1查看 1.4K关注 0票数 0

我正在尝试创建一个食谱包装器来部署带有厨师的MySQL,但它似乎没有插入我正在设置的菜谱中的初始根密码。

代码语言:javascript
复制
mysql_client 'default' do
    version '5.6'
    action :create
end

if node['kaltiot_mysql']['deployServer'] == 'true'

    #-------------------------------------------
    # Create the database server and start it
    #-------------------------------------------
    mysql_service 'default' do
      port '3306'
      version '5.6'
      initial_root_password node['mysql']['initial_root_password']
      action [:create, :start]
    end

    #-------------------------------------------
    # Create the database and the user to access
    #-------------------------------------------
    include_recipe 'database::mysql'

    connection_params = {
      :host     => 'localhost',
      :username => 'root',
      :password => node['mysql']['initial_root_password']
    }

    mysql_database 'test' do
      connection connection_params
      action :create
    end

    mysql_database_user 'usertest' do
      connection connection_params
      password node['mysql']['initial_root_password']
      privileges [:all]
      action [:create, :grant]
    end

end

我的环境如下:

我正在使用的食谱是最新的版本:

  • mysql 6.0.7
  • 数据库3.0.0

由于未设置初始密码,数据库部件由于无法访问数据库而失败。

shell上的日志如下:

代码语言:javascript
复制
 * bash[default :create initialize mysql database] action run[2015-01-16T10:03:03+00:00] INFO: Processing bash[default :create initialize mysql database] action run (/tmp/kitchen/cache/cookbooks/mysql/libraries/provider_mysql_service.rb line 143)
Installing MySQL system tables...       2015-01-16 10:03:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
OK

Filling help tables...
2015-01-16 10:03:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

 /usr/bin/mysqladmin -u root password 'new-password'
 /usr/bin/mysqladmin -u root -h default-centos-66.vagrantup.com password 'new-password'

Alternatively you can run:

 /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

 cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

 cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

 http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[2015-01-16T10:03:08+00:00] INFO: bash[default :create initialize mysql database] ran successfully

     - execute "bash"  "/tmp/chef-script20150116-2184-1tou5sq"
   * bash[default :create initial records] action nothing[2015-01-16T10:03:08+00:00] INFO: Processing bash[default :create initial records] action nothing (/tmp/kitchen/cache/cookbooks/mysql/libraries/provider_mysql_service.rb line 152)
(skipped due to action :nothing)
[2015-01-16T10:03:08+00:00] INFO: bash[default :create initialize mysql database] sending run action to bash[default :create initial records] (delayed)
   * bash[default :create initial records] action run[2015-01-16T10:03:08+00:00] INFO: Processing bash[default :create initial records] action run (/tmp/kitchen/cache/cookbooks/mysql/libraries/provider_mysql_service.rb line 152)
150116 10:03:08 mysqld_safe Logging to '/var/log/mysql-default/error.log'.
150116 10:03:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql-default
150116 10:03:12 mysqld_safe mysqld from pid file /var/run/mysql-default/mysqld.pid ended
[2015-01-16T10:03:12+00:00] INFO: bash[default :create initial records] ran successfully

- execute "bash"  "/tmp/chef-script20150116-2184-gjywc9"       

任何人都可以带来一些启示,为什么它没有设置这个初始密码?

谢谢你,-Enrique

EN

回答 1

Stack Overflow用户

发布于 2015-01-16 13:12:04

..。似乎您没有看过mysql食谱Readme:引用它:

使用 在食谱的metadata.rb中对mysql食谱设置一个依赖项 depends 'mysql', '~> 6.0' Then, in a recipe: mysql_service 'default‘do port '3306’版本'5.5‘initial_root_password 'change me’action :create,:start end mysql_config 'default‘do source 'mysite.cnf.erb’通知:重新启动,'mysql_servicedefault‘操作:创建结束

mysql_service资源在mysql停止后,假设会有一个mysql_config资源,在此之后将重新启动服务。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27980777

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档