User:Jbond/Mariadb

From Wikitech
Jump to navigation Jump to search

On the host puppet configurations add the following puppet classes

Its possible the following could be replaced with role::mariadb

profile::mariadb::packages_wmf
mariadb::service
mariadb::config

and the following Hiera Config

mariadb::config::basedir: /opt/wmf-mariadb104
mariadb::config::config: role/mariadb/mysqld_config/misc.my.cnf.erb
mariadb::config::datadir: /srv/sqldata
mariadb::config::ssl: puppet-cert

We then need to run puppet to install the mariadb profiles. after this run the following command to initialise the database

$ sudo /opt/wmf-mariadb104/scripts/mysql_install_db --user=mysql --basedir=/opt/wmf-mariadb104 --datadir=/srv/sqldata
$ systemctl status mariadb.service

Then create your db and users e.g.

$ mysql
MariaDB [(none)]> create database pki;
MariaDB [(none)]> GRANT USAGE ON *.* TO `pki`@`127.0.0.1` IDENTIFIED BY 'super_secure_password';
MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE,ALTER ON `pki`.* TO 'pki'@'127.0.0.1';
MariaDB [(none)]> flush privileges;