Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > b50d8ee6d7871fcc13c0677a9364ed59 > files > 313

bcfg2-doc-1.3.0-1.fc17.noarch.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>MySQL example &mdash; Bcfg2 1.3.0 documentation</title>
    
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/sidebar.js"></script>
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="top" title="Bcfg2 1.3.0 documentation" href="../../index.html" />
    <link rel="up" title="Example files" href="../files.html" />
    <link rel="next" title="ntp example" href="ntp.html" />
    <link rel="prev" title="Example files" href="../files.html" />
 
<link rel="stylesheet" href="../../_static/bcfg2.css" type=""/>

  </head>
  <body>

<div style="text-align: left; padding: 10px 10px 15px 15px">
<a href="../../index.html"><img src="../../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="ntp.html" title="ntp example"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../files.html" title="Example files"
             accesskey="P">previous</a> |</li>
	<li><a href="../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../index.html" >Appendix</a> &raquo;</li>
          <li><a href="../files.html" accesskey="U">Example files</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <span class="target" id="appendix-files-mysql"></span><div class="section" id="mysql-example">
<h1>MySQL example<a class="headerlink" href="#mysql-example" title="Permalink to this headline">ΒΆ</a></h1>
<p>I had some time ago to continue with putting my configuration into
Bcfg2 and maybe this helps someone else.</p>
<p>I added a new bundle:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&quot;mysql-server&quot;</span> <span class="na">version=</span><span class="s">&quot;3.0&quot;</span><span class="nt">&gt;</span>
   <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&quot;/root/bcfg2-install/mysql/users.sh&quot;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&quot;/root/bcfg2-install/mysql/users.sql&quot;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;PostInstall</span> <span class="na">name=</span><span class="s">&quot;/root/bcfg2-install/mysql/users.sh&quot;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&quot;mysql-server-4.1&quot;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&quot;mysql&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">users.sh</span></tt> script looks like this:</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="c">#!/bin/sh</span>

mysql --defaults-extra-file<span class="o">=</span>/etc/mysql/debian.cnf mysql <span class="se">\</span>
    &lt; /root/bcfg2-install/mysql/users.sql
</pre></div>
</div>
<p>On debian there is a user account in <tt class="docutils literal"><span class="pre">/etc/mysql/debian.cnf</span></tt>
automatically created, but you could also (manually) create a
user in the database that has enough permissions and add the
login information in a file yourself. This file looks like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span><span class="n">client</span><span class="p">]</span>
<span class="n">host</span>     <span class="o">=</span> <span class="n">localhost</span>
<span class="n">user</span>     <span class="o">=</span> <span class="n">debian</span><span class="o">-</span><span class="n">sys</span><span class="o">-</span><span class="n">maint</span>
<span class="n">password</span> <span class="o">=</span> <span class="n">XXXXXXXXXX</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">users.sql</span></tt> looks like this:</p>
<div class="highlight-python"><pre>DELETE FROM db;
INSERT INTO db VALUES ('localhost', 'phpmyadmin', 'pma', 'Y', 'Y',
'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N');

DELETE FROM user WHERE User &lt;&gt; 'debian-sys-maint';
INSERT INTO user VALUES ('localhost', 'root', 'XXXXXXXXXXX', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', 0, 0, 0);
INSERT INTO user VALUES ('localhost', 'pma', '', 'N', 'N', 'N', 'N',
'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N',
'N', 'N', 'N', '', '', '', '', 0, 0, 0);

FLUSH PRIVILEGES;</pre>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="../files.html"
                        title="previous chapter">Example files</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="ntp.html"
                        title="next chapter">ntp example</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/appendix/files/mysql.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="ntp.html" title="ntp example"
             >next</a> |</li>
        <li class="right" >
          <a href="../files.html" title="Example files"
             >previous</a> |</li>
	<li><a href="../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../index.html" >Appendix</a> &raquo;</li>
          <li><a href="../files.html" >Example files</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Narayan Desai.
      Last updated on Mar 20, 2013.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>