Create.vmail.sql

From SaruWiki
Revision as of 22:04, 30 October 2008 by Saruman! (talk | contribs) (limited vmal_admin rights)
Jump to navigation Jump to search
USE mysql;

REPLACE INTO user (host, user, password)
    VALUES (
        'localhost',
        'vmail_admin',
        PASSWORD('SuperSecret')
);

REPLACE INTO db (host, db, user, select_priv)
    VALUES (
        'localhost',
        'vmail',
        'vmail_admin',
        'Y'
); 

-- Make sure that priviliges are reloaded.
FLUSH PRIVILEGES;

-- we're assuming the database does not exist yet
CREATE DATABASE vmail;

USE vmail;

CREATE TABLE domains (
    domain        VARCHAR(50) NOT NULL,

    PRIMARY KEY (domain) ) TYPE=MyISAM;

CREATE TABLE forwardings (
    source        VARCHAR(80) NOT NULL,
    destination   TEXT NOT NULL,

    PRIMARY KEY (source) ) TYPE=MyISAM;

CREATE TABLE users (
    emailaddr     VARCHAR(80) NOT NULL,
    passwd        VARCHAR(30) NOT NULL,

    PRIMARY KEY (emailaddr) ) TYPE=MyISAM;

CREATE TABLE relaydomains (
    rdomain       VARCHAR(80) NOT NULL,
    transport     VARCHAR(80) NOT NULL,

    PRIMARY KEY (rdomain) ) TYPE=MyISAM;

FLUSH PRIVILEGES;