Managing a database means more than ensuring the service is running; a database server is nothing without databases. Databases need users and privileges. Privileges are handled with GRANT
statements. We will use the puppetlabs-mysql
package to create a database and a user with access to that database. We'll create a MariaDB user, drupal
, and a database, called drupal
. We'll create a nodes
table within the drupal
database and place data into that table.
Follow these steps to create the databases and users:
mysql::db { 'drupal': host => 'localhost', user => 'drupal', password => 'Cookbook', sql => '/root/drupal.sql', require => File['/root/drupal.sql'] } $drupal = @(DRUPAL) CREATE TABLE users ( id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255), body TEXT); INSERT INTO users (id, title, body) VALUES (1,'First Node','Contents of first Node...