diskimage-builder/elements/os-svc-install/bin/os-db-create
Tim Miller 6cfd9681b7 Seperate install of services and start scripts:
This allows openstack services to be git/pip installed
without installing any startup scripts.

This is useful for keystone-db or nova-db elements, for
example, where the service must be installed to perform
database migration, but no service start scripts need
be installed.

Additionally, add a tool to create openstack sql databases.

Use openstack pypi mirror:

Use the openstack pypi mirror for openstack service
installation. It's much faster than pypi.org.

Also, pip install $svc_repo/tools/pip-requires first,
if it exists, which is required to pick up oslo.config.

Change-Id: I72751d4da59f8597d20aea2f27a9dfabe2f63a8f
2013-03-07 11:45:41 -08:00

20 lines
399 B
Bash
Executable File

#!/bin/bash
set -eu
function create_db {
local sql="
drop database if exists $1;
create database if not exists $1;
grant all on $1.* to '$2'@'localhost' identified by '$3';
grant all on $1.* to '$2'@'%' identified by '$3';
flush privileges;"
echo "$sql" | mysql
}
if [ $# -lt 3 ]; then
echo "Usage: os-db-create DB_NAME DB_USER DB_PASS"
exit 1
fi
create_db $*