-- Create database for virtual hosts
CREATE DATABASE IF NOT EXISTS PH_VMAIL_DB_NAME CHARACTER SET utf8;

-- Permissions
GRANT SELECT
    ON PH_VMAIL_DB_NAME.*
    TO 'PH_VMAIL_DB_BIND_USER'@'PH_MYSQL_GRANT_HOST'
    IDENTIFIED BY 'PH_VMAIL_DB_BIND_PASSWD';

-- GRANT SELECT ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_BIND_USER'@'PH_HOSTNAME' IDENTIFIED BY 'PH_VMAIL_DB_BIND_PASSWD';
GRANT SELECT,INSERT,DELETE,UPDATE
    ON PH_VMAIL_DB_NAME.*
    TO 'PH_VMAIL_DB_ADMIN_USER'@'PH_MYSQL_GRANT_HOST'
    IDENTIFIED BY 'PH_VMAIL_DB_ADMIN_PASSWD';

-- GRANT SELECT,INSERT,DELETE,UPDATE ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_ADMIN_USER'@'PH_HOSTNAME' IDENTIFIED BY 'PH_VMAIL_DB_ADMIN_PASSWD';

FLUSH PRIVILEGES;
