diff --git a/conf/type/__mysql_database/gencode-remote b/conf/type/__mysql_database/gencode-remote
new file mode 100755
index 00000000..c0e862f3
--- /dev/null
+++ b/conf/type/__mysql_database/gencode-remote
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# 2012 Benedikt Koeppel (code@benediktkoeppel.ch)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+#
+
+# if --database was specified
+if [ -f "$__object/parameter/name" ]; then
+ database="$(cat "$__object/parameter/name")"
+else # otherwise use the object id as database name
+ database="$__object_id"
+fi
+
+cat <<-EOFF
+mysql -u root <<-EOF
+ CREATE DATABASE IF NOT EXISTS $database
+EOF
+EOFF
+
+# if --user was specified
+if [ -f "$__object/parameter/user" ]; then
+ user="$(cat "$__object/parameter/user")"
+
+ # if --password was specified
+ if [ -f "$__object/parameter/password" ]; then
+ password="$(cat "$__object/parameter/password")"
+ cat <<-EOFF
+ mysql -u root <<-EOF
+ GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost' IDENTIFIED BY '$password';
+EOF
+EOFF
+ else
+ password=""
+ cat <<-EOFF
+ mysql -u root <<-EOF
+ GRANT ALL PRIVILEGES ON $database.* to '$user'@'localhost';
+EOF
+EOFF
+ fi
+fi
diff --git a/conf/type/__mysql_database/man.text b/conf/type/__mysql_database/man.text
new file mode 100644
index 00000000..f184a30e
--- /dev/null
+++ b/conf/type/__mysql_database/man.text
@@ -0,0 +1,49 @@
+cdist-type__mysql_database(7)
+=============================
+Benedikt Koeppel
+
+
+NAME
+----
+cdist-type__mysql_database - Manage a MySQL database
+
+
+DESCRIPTION
+-----------
+This cdist type allows you to install a MySQL database.
+
+
+REQUIRED PARAMETERS
+-------------------
+None.
+
+OPTIONAL PARAMETERS
+-------------------
+name::
+ The name of the database to install
+ defaults to the object id
+
+user::
+ A user that should have access to the database
+
+password::
+ The password for the user who manages the database
+
+
+EXAMPLES
+--------
+
+--------------------------------------------------------------------------------
+__mysql_database "cdist" --name "cdist" --user "myuser" --password "mypwd"
+--------------------------------------------------------------------------------
+
+
+SEE ALSO
+--------
+- cdist-type(7)
+
+
+COPYING
+-------
+Copyright \(C) 2012 Benedikt Koeppel. Free use of this software is
+granted under the terms of the GNU General Public License version 3 (GPLv3).
diff --git a/conf/type/__mysql_database/parameter/optional b/conf/type/__mysql_database/parameter/optional
new file mode 100644
index 00000000..756afee7
--- /dev/null
+++ b/conf/type/__mysql_database/parameter/optional
@@ -0,0 +1,3 @@
+name
+user
+password