# MySQL Cookbook

**URL:** <https://discourse.chef.io/t/mysql-cookbook/3784>\
**Category:** Chef Infra (archive)\
**Created:** [March 21, 2013, 10:23pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784 "2013-03-21T22:23:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Barre](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/steven_barre/32/296_2.png) [@Steven\_Barre](https://discourse.chef.io/u/Steven_Barre)\
**Post date:** [March 21, 2013, 10:23pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/1 "2013-03-21T22:23:18Z")

</div>

Hello

In attributes/server.rb

> <https://github.com/chef-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb>

There is the use of node[“mysql”][“version”]. But I don’t see where that  
gets set. Could someone explain that to me?

# –

Steven Barre, RHCE, ZCE, MCP  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)

# Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893

---

<div class="post-metadata">

**Author:** ![Steven\_Barre](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/steven_barre/32/296_2.png) [@Steven\_Barre](https://discourse.chef.io/u/Steven_Barre)\
**Post date:** [March 26, 2013, 6:24pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/2 "2013-03-26T18:24:44Z")

</div>

Does no one know how this is supposed to work?

=================================================  
Steven Barre, RHCE, ZCE, MCP  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)

# Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893

On 2013-03-21 15:23, Steven Barre wrote:

> Hello
> 
> In attributes/server.rb  
> [mysql/attributes/server.rb at bfabce615dffe144a161bc5979873a7e9811f172 · sous-chefs/mysql · GitHub](https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47)
> 
> There is the use of node["mysql"]["version"]. But I don't see where  
> that gets set. Could someone explain that to me?

---

<div class="post-metadata">

**Author:** ![Aaron\_Brown](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aaron_brown/32/568_2.png) [@Aaron\_Brown](https://discourse.chef.io/u/Aaron_Brown)\
**Post date:** [March 26, 2013, 6:51pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/3 "2013-03-26T18:51:32Z")

</div>

I discovered that I had to set it manually.

On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre \<  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:

> Does no one know how this is supposed to work?
> 
> ==============================\*\*===================  
> Steven Barre, RHCE, ZCE, MCP  
> steven@realestatewebmasters.\*\*com [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)
> 
> Systems Administrator / Programmer  
> Real Estate Webmasters - 250-753-9893  
> ==============================\*\*====================
> 
> On 2013-03-21 15:23, Steven Barre wrote:
> 
> > Hello
> > 
> > In attributes/server.rb  
> > [https://github.com/opscode-\*\*cookbooks/mysql/blob/](https://github.com/opscode-**cookbooks/mysql/blob/)\*\*  
> > bfabce615dffe144a161bc5979873a\*\*7e9811f172/attributes/server.\*\*rb#L41-47[https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47](https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47)
> > 
> > There is the use of node["mysql"]["version"]. But I don't see where that  
> > gets set. Could someone explain that to me?

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [March 26, 2013, 9:07pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/4 "2013-03-26T21:07:02Z")

</div>

Same here, i set it in the database server role for our nodes... it seems  
undocumented, and i was waiting / hoping whomever added that code would  
comment here

On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown [aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)wrote:

> I discovered that I had to set it manually.
> 
> On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre \<  
> [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:
> 
> > Does no one know how this is supposed to work?
> > 
> > ==============================\*\*===================  
> > Steven Barre, RHCE, ZCE, MCP  
> > steven@realestatewebmasters.\*\*com [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)
> > 
> > Systems Administrator / Programmer  
> > Real Estate Webmasters - 250-753-9893  
> > ==============================\*\*====================
> > 
> > On 2013-03-21 15:23, Steven Barre wrote:
> > 
> > > Hello
> > > 
> > > In attributes/server.rb  
> > > [https://github.com/opscode-\*\*cookbooks/mysql/blob/](https://github.com/opscode-**cookbooks/mysql/blob/)\*\*  
> > > bfabce615dffe144a161bc5979873a\*\*7e9811f172/attributes/server.\*\*rb#L41-47[https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47](https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47)
> > > 
> > > There is the use of node["mysql"]["version"]. But I don't see where that  
> > > gets set. Could someone explain that to me?

---

<div class="post-metadata">

**Author:** ![Steven\_Barre](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/steven_barre/32/296_2.png) [@Steven\_Barre](https://discourse.chef.io/u/Steven_Barre)\
**Post date:** [March 26, 2013, 9:57pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/5 "2013-03-26T21:57:46Z")

</div>

I've also been wondering why some attributes are "tuneable" and others  
are not. I also noticed the config file seems to just be the stock  
ubuntu one with a few modifications.

I'm also trying to understand why mysql is installed, started, and then  
the conf file is changed then mysql restarted. Wouldn't it make more  
sense to have the config file set up before the first run of mysql?  
Things like pid file and innodb log files don't handle changing very  
well. (as pointed out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))

I'm starting to think this need some rewriting .... I'll volunteer, but  
I'm new at this. Some input from others would be appreciated.

=================================================  
Steven Barre, RHCE, ZCE, MCP  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)

# Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893

On 2013-03-26 14:07, Jesse Campbell wrote:

> Same here, i set it in the database server role for our nodes... it  
> seems undocumented, and i was waiting / hoping whomever added that  
> code would comment here
> 
> On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown \<[aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)  
> [mailto:aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)\> wrote:
> 
> ```
> I discovered that I had to set it manually.
> 
> On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre
> <steven@realestatewebmasters.com
> <mailto:steven@realestatewebmasters.com>> wrote:
> 
> Does no one know how this is supposed to work?
> 
> =================================================
> Steven Barre, RHCE, ZCE, MCP
> steven@realestatewebmasters.com
> <mailto:steven@realestatewebmasters.com>
> 
> Systems Administrator / Programmer
> Real Estate Webmasters - 250-753-9893 <tel:250-753-9893>
> ==================================================
> 
> On 2013-03-21 15:23, Steven Barre wrote:
> 
> Hello
> 
> In attributes/server.rb
> https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47
> 
> There is the use of node["mysql"]["version"]. But I don't
> see where that gets set. Could someone explain that to me?
> 
> ```

---

<div class="post-metadata">

**Author:** ![Ranjib](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/ranjib/32/1040_2.png) [@Ranjib](https://discourse.chef.io/u/Ranjib)\
**Post date:** [March 26, 2013, 10:09pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/6 "2013-03-26T22:09:02Z")

</div>

attributes not only allows us to tune/customize the behavior of an recipe,  
without changing it (kinda open close principle applied to recipes) , but  
also provides a mechanism for detecting or storing persistent information  
beyond a chef run. So even if you dont want to customize a property, but  
just want to access it beyond the chef run you might want to model it as an  
attribute. iirc the mysql cookbook generates a random root password (using  
the openssl cookbook libraries?) and stores it as an attribute, here you  
cant change it , but still you can grab it and use for other tooling (like  
the lwrps for database and user uses this info), the cookbook also restrict  
the root access to localhost.

regarding multiple service start, ubuntu does this as part of the  
installation, and also the config changes require service restart/reload  
again.  
Again these are not the best implementation, but they are getting better. I  
recall joshua had posted on the mailing list regarding this specific case,  
i.e. mysql root password/mysql cookbook and some tricky use cases.

On Tue, Mar 26, 2013 at 2:57 PM, Steven Barre \<  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:

> I've also been wondering why some attributes are "tuneable" and others  
> are not. I also noticed the config file seems to just be the stock ubuntu  
> one with a few modifications.
> 
> I'm also trying to understand why mysql is installed, started, and then  
> the conf file is changed then mysql restarted. Wouldn't it make more sense  
> to have the config file set up before the first run of mysql? Things like  
> pid file and innodb log files don't handle changing very well. (as pointed  
> out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))
> 
> I'm starting to think this need some rewriting .... I'll volunteer, but  
> I'm new at this. Some input from others would be appreciated.
> 
> =================================================  
> Steven Barre, RHCE, ZCE, [MCPsteven@realestatewebmasters.com](mailto:MCPsteven@realestatewebmasters.com)
> 
> # Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893
> 
> On 2013-03-26 14:07, Jesse Campbell wrote:
> 
> Same here, i set it in the database server role for our nodes... it seems  
> undocumented, and i was waiting / hoping whomever added that code would  
> comment here
> 
> On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown [aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)wrote:
> 
> > I discovered that I had to set it manually.
> > 
> > On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre \<  
> > [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:
> > 
> > > Does no one know how this is supposed to work?
> > > 
> > > =================================================  
> > > Steven Barre, RHCE, ZCE, MCP  
> > > [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)
> > > 
> > > # Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893
> > > 
> > > On 2013-03-21 15:23, Steven Barre wrote:
> > > 
> > > > Hello
> > > > 
> > > > In attributes/server.rb
> > > > 
> > > > [mysql/attributes/server.rb at bfabce615dffe144a161bc5979873a7e9811f172 · sous-chefs/mysql · GitHub](https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47)
> > > > 
> > > > There is the use of node["mysql"]["version"]. But I don't see where  
> > > > that gets set. Could someone explain that to me?

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [March 26, 2013, 10:28pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/7 "2013-03-26T22:28:15Z")

</div>

i'd like to see a little cleanup of the start / restart / another restart  
issues, as it has definitely caused mysql server crashes on a number of our  
prod servers...  
also, i'd like to see changes to the config file be kept to a minimum, as  
with each version bump we take, we find only about 90% of what has changed,  
and it isn't until it goes live with production-level traffic (possibly  
after a few days) that we notice that someone's tweak has broken something  
else for us 🙂

my.cnf is touchy...

-jesse

On Tue, Mar 26, 2013 at 6:09 PM, Ranjib Dey [dey.ranjib@gmail.com](mailto:dey.ranjib@gmail.com) wrote:

> attributes not only allows us to tune/customize the behavior of an recipe,  
> without changing it (kinda open close principle applied to recipes) , but  
> also provides a mechanism for detecting or storing persistent information  
> beyond a chef run. So even if you dont want to customize a property, but  
> just want to access it beyond the chef run you might want to model it as an  
> attribute. iirc the mysql cookbook generates a random root password (using  
> the openssl cookbook libraries?) and stores it as an attribute, here you  
> cant change it , but still you can grab it and use for other tooling (like  
> the lwrps for database and user uses this info), the cookbook also restrict  
> the root access to localhost.
> 
> regarding multiple service start, ubuntu does this as part of the  
> installation, and also the config changes require service restart/reload  
> again.  
> Again these are not the best implementation, but they are getting better.  
> I recall joshua had posted on the mailing list regarding this specific  
> case, i.e. mysql root password/mysql cookbook and some tricky use cases.
> 
> On Tue, Mar 26, 2013 at 2:57 PM, Steven Barre \<  
> [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:
> 
> > I've also been wondering why some attributes are "tuneable" and others  
> > are not. I also noticed the config file seems to just be the stock ubuntu  
> > one with a few modifications.
> > 
> > I'm also trying to understand why mysql is installed, started, and then  
> > the conf file is changed then mysql restarted. Wouldn't it make more sense  
> > to have the config file set up before the first run of mysql? Things like  
> > pid file and innodb log files don't handle changing very well. (as pointed  
> > out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))
> > 
> > I'm starting to think this need some rewriting .... I'll volunteer, but  
> > I'm new at this. Some input from others would be appreciated.
> > 
> > =================================================  
> > Steven Barre, RHCE, ZCE, [MCPsteven@realestatewebmasters.com](mailto:MCPsteven@realestatewebmasters.com)
> > 
> > # Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893
> > 
> > On 2013-03-26 14:07, Jesse Campbell wrote:
> > 
> > Same here, i set it in the database server role for our nodes... it seems  
> > undocumented, and i was waiting / hoping whomever added that code would  
> > comment here
> > 
> > On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown [aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)wrote:
> > 
> > > I discovered that I had to set it manually.
> > > 
> > > On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre \<  
> > > [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:
> > > 
> > > > Does no one know how this is supposed to work?
> > > > 
> > > > =================================================  
> > > > Steven Barre, RHCE, ZCE, MCP  
> > > > [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)
> > > > 
> > > > # Systems Administrator / Programmer Real Estate Webmasters - 250-753-9893
> > > > 
> > > > On 2013-03-21 15:23, Steven Barre wrote:
> > > > 
> > > > > Hello
> > > > > 
> > > > > In attributes/server.rb
> > > > > 
> > > > > [mysql/attributes/server.rb at bfabce615dffe144a161bc5979873a7e9811f172 · sous-chefs/mysql · GitHub](https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47)
> > > > > 
> > > > > There is the use of node["mysql"]["version"]. But I don't see where  
> > > > > that gets set. Could someone explain that to me?

---

<div class="post-metadata">

**Author:** ![Aaron\_Brown](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aaron_brown/32/568_2.png) [@Aaron\_Brown](https://discourse.chef.io/u/Aaron_Brown)\
**Post date:** [March 26, 2013, 10:42pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/8 "2013-03-26T22:42:13Z")

</div>

On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre \<  
[steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:

> I'm also trying to understand why mysql is installed, started, and then  
> the conf file is changed then mysql restarted. Wouldn't it make more sense  
> to have the config file set up before the first run of mysql? Things like  
> pid file and innodb log files don't handle changing very well. (as pointed  
> out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))

I have just finished committing a bunch of changes that move the template  
creation to before the package is installed for this very reason, if you  
are interested in reviewing:

> **[GitHub - aaronbbrown/mysql at mysql56](https://github.com/aaronbbrown/mysql/tree/mysql56)**
>
> mysql56

I will prepare a pull request in the next few days.

Aaron

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [March 26, 2013, 10:58pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/9 "2013-03-26T22:58:33Z")

</div>

i thought the reason the template happened after install was because most  
packages include a my.cnf which would overwrite the template...

On Tue, Mar 26, 2013 at 6:42 PM, Aaron Brown [aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)wrote:

> On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre \<  
> [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com)\> wrote:
> 
> > I'm also trying to understand why mysql is installed, started, and then  
> > the conf file is changed then mysql restarted. Wouldn't it make more sense  
> > to have the config file set up before the first run of mysql? Things like  
> > pid file and innodb log files don't handle changing very well. (as pointed  
> > out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))
> 
> I have just finished committing a bunch of changes that move the template  
> creation to before the package is installed for this very reason, if you  
> are interested in reviewing:  
> [GitHub - aaronbbrown/mysql at mysql56](https://github.com/9minutesnooze/mysql/tree/mysql56)
> 
> I will prepare a pull request in the next few days.
> 
> Aaron

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [March 26, 2013, 11:10pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/10 "2013-03-26T23:10:39Z")

</div>

Indeed, that is why there is the restart dances / preseed / templates  
/ template re-opening at specific stages.

One day I suppose we'll be able to install mysql or mariadb without  
starting the service or shipping potentially broken config; it's so  
hard to reverse the changes once it has started up, nuke data etc.  
Yawn.

--AJ

On 27 March 2013 11:58, Jesse Campbell [hikeit@gmail.com](mailto:hikeit@gmail.com) wrote:

> i thought the reason the template happened after install was because most  
> packages include a my.cnf which would overwrite the template...
> 
> On Tue, Mar 26, 2013 at 6:42 PM, Aaron Brown [aaron@9minutesnooze.com](mailto:aaron@9minutesnooze.com)  
> wrote:
> 
> > On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre  
> > [steven@realestatewebmasters.com](mailto:steven@realestatewebmasters.com) wrote:
> > 
> > > I'm also trying to understand why mysql is installed, started, and then  
> > > the conf file is changed then mysql restarted. Wouldn't it make more sense  
> > > to have the config file set up before the first run of mysql? Things like  
> > > pid file and innodb log files don't handle changing very well. (as pointed  
> > > out here [http://tickets.opscode.com/browse/COOK-2100](http://tickets.opscode.com/browse/COOK-2100))
> > 
> > I have just finished committing a bunch of changes that move the template  
> > creation to before the package is installed for this very reason, if you are  
> > interested in reviewing:  
> > [GitHub - aaronbbrown/mysql at mysql56](https://github.com/9minutesnooze/mysql/tree/mysql56)
> > 
> > I will prepare a pull request in the next few days.
> > 
> > Aaron

---

<div class="post-metadata">

**Author:** ![Aaron\_Brown](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aaron_brown/32/568_2.png) [@Aaron\_Brown](https://discourse.chef.io/u/Aaron_Brown)\
**Post date:** [March 26, 2013, 11:14pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/11 "2013-03-26T23:14:16Z")

</div>

On Tue, Mar 26, 2013 at 6:58 PM, Jesse Campbell [hikeit@gmail.com](mailto:hikeit@gmail.com) wrote:

> i thought the reason the template happened after install was because most  
> packages include a my.cnf which would overwrite the template...

All modern package managers that I'm aware of will keep an existing config  
file and specifically not overwrite it. Are you aware of a specific  
package or distribution that errantly overwrites an existing config file?

---

<div class="post-metadata">

**Author:** ![Bryan\_McLellan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_mclellan/32/81_2.png) [@Bryan\_McLellan](https://discourse.chef.io/u/Bryan_McLellan)\
**Post date:** [March 27, 2013, 5:14pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/12 "2013-03-27T17:14:39Z")

</div>

On Tue, Mar 26, 2013 at 7:10 PM, AJ Christensen [aj@junglist.gen.nz](mailto:aj@junglist.gen.nz) wrote:

> One day I suppose we'll be able to install mysql or mariadb without  
> starting the service or shipping potentially broken config; it's so  
> hard to reverse the changes once it has started up, nuke data etc.  
> Yawn.

On recent Ubuntu releases that use upstart, if you create  
"/etc/init/mysql.override" with the word "manual" in it before you  
install the package (tested on 12.10 quantal with  
mysql-server-5.5=5.5.29-0ubuntu0.12.10.1) then the service will not  
start automatically when the package is installed (or on startup).

On Debian, if you create "/usr/sbin/policy-rc.d" with these contents,  
it will prevent mysql from starting on installation (tested on 6.0.6  
squeeze with mysql-server-5.1=5.1.66-0+squeeze1

=======  
#!/bin/sh

# if ["x$1" = "xmysql"] && ["x$2" = "xstart"]; then echo "Not starting mysql server due to policy" \>&2 exit 101 fi

Bryan

---

<div class="post-metadata">

**Author:** ![AJ\_Christensen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/aj_christensen/32/525_2.png) [@AJ\_Christensen](https://discourse.chef.io/u/AJ_Christensen)\
**Post date:** [March 27, 2013, 7:03pm UTC](https://discourse.chef.io/t/mysql-cookbook/3784/13 "2013-03-27T19:03:24Z")

</div>

Now that is a cool idea.. Thanks Bryan 😉

-AJ  
On 28/03/2013 6:15 AM, "Bryan McLellan" [btm@loftninjas.org](mailto:btm@loftninjas.org) wrote:

> On Tue, Mar 26, 2013 at 7:10 PM, AJ Christensen [aj@junglist.gen.nz](mailto:aj@junglist.gen.nz)  
> wrote:
> 
> > One day I suppose we'll be able to install mysql or mariadb without  
> > starting the service or shipping potentially broken config; it's so  
> > hard to reverse the changes once it has started up, nuke data etc.  
> > Yawn.
> 
> On recent Ubuntu releases that use upstart, if you create  
> "/etc/init/mysql.override" with the word "manual" in it before you  
> install the package (tested on 12.10 quantal with  
> mysql-server-5.5=5.5.29-0ubuntu0.12.10.1) then the service will not  
> start automatically when the package is installed (or on startup).
> 
> On Debian, if you create "/usr/sbin/policy-rc.d" with these contents,  
> it will prevent mysql from starting on installation (tested on 6.0.6  
> squeeze with mysql-server-5.1=5.1.66-0+squeeze1
> 
> =======  
> #!/bin/sh
> 
> # if ["x$1" = "xmysql"] && ["x$2" = "xstart"]; then echo "Not starting mysql server due to policy" \>&2 exit 101 fi
> 
> Bryan
