Code Monkey home page Code Monkey logo

vagrant-puppet-mysql's Introduction

Vagrant Puppet MySQL

Puppet manifests to install and configure MySQL on our default Ubuntu Precise Vagrant development server.

Usage

Install MySQL

To install the MySQL client and server add one of the following to your manifest:

  • class { 'mysql': }
  • include 'mysql'

This will also set the root password (see below for further details), remove any anonymous user accounts, and configure MySQL to use the UTC timezone.

Specify the root password

By default, the root password will be set to 'root'. You can specify an alternative password using the root_password parameter:

# Install MySQL, and set the root password
class { 'mysql':
  root_password => 'secure_password',
}

Create a database

To create a new database, pass the database name to the mysql::db::create helper:

# Creates the 'devdb' database
mysql::db::create { 'devdb': }

Create multiple databases

To create multiple database using a single statement, pass an array to the mysql::db::create helper:

# Creates three databases
mysql::db::create { ['devdb', 'stagingdb', 'productiondb']: }

Create a user, and grant privileges

To create grant privileges to a user pass the username, host, password, and database to the mysql::user::grant helper. If the user does not already exist, it will be created.

# Grants ALL privileges on the 'deliverance' database to jimbob@localhost
mysql::user::grant { 'jimbob_all_privileges':
  user     => 'jimbob',
  host     => 'localhost',
  password => 'jimbobsecret',
  database => 'deliverance',
}

# 'user' parameter inferred from title
mysql::user::grant { 'jimbob':
  host     => 'localhost',
  password => 'jimbobsecret',
  database => 'deliverance',
}

For greater control, you may also pass the table and privileges you wish to set.

# Grants ALL privileges on the 'deliverance.squeal' table to
# jimbob@localhost
mysql::user::grant { 'jimbob':
  host     => 'localhost',
  password => 'jimbobsecret',
  database => 'deliverance',
  table    => 'squeal',
}

# Grants CREATE privileges on the 'deliverance' database to
# jimbob@localhost
mysql::user::grant { 'jimbob':
  host       => 'localhost',
  password => 'jimbobsecret',
  database   => 'deliverance',
  privileges => 'CREATE',
}

Drop a user

To drop a user, pass the username and host to the mysql::user::drop helper:

# Drops the user [email protected]
mysql::user::drop {
  user => 'marylou',
  host => '192.168.0.2',
}

# 'user' parameter inferred from title
mysql::user::drop { 'marylou':
  host => '192.168.0.2',
}

vagrant-puppet-mysql's People

Watchers

Eric Ahn avatar James Cloos avatar

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.