Create.vmail.sql: Difference between revisions

From SaruWiki
Jump to navigation Jump to search
(DB creation script)
 
m (limited vmal_admin rights)
Line 1: Line 1:
USE mysql;
USE mysql;
 
REPLACE INTO user (host, user, password)
REPLACE INTO user (host, user, password)
    VALUES (
    VALUES (
        'localhost',
        'localhost',
        'vmail_admin',
        'vmail_admin',
        PASSWORD('SuperSecret')
        PASSWORD('SuperSecret')
);
);
 
REPLACE INTO db (host, db, user, select_priv, insert_priv, update_priv,
REPLACE INTO db (host, db, user, select_priv)
                delete_priv, create_priv, drop_priv, index_priv)
    VALUES (
    VALUES (
        'localhost',
        'localhost',
        'vmail',
        'vmail',
        'vmail_admin',
        'vmail_admin',
        'Y'
        'Y', 'Y', 'Y', 'Y',
);  
        'Y', 'Y', 'Y'
);
-- Make sure that priviliges are reloaded.
 
FLUSH PRIVILEGES;
-- Make sure that priviliges are reloaded.
FLUSH PRIVILEGES;
-- we're assuming the database does not exist yet
 
CREATE DATABASE vmail;
-- we're assuming the database does not exist yet
CREATE DATABASE vmail;
USE vmail;
 
USE vmail;
CREATE TABLE domains (
 
    domain        VARCHAR(50) NOT NULL,
CREATE TABLE domains (
    domain        VARCHAR(50) NOT NULL,
    PRIMARY KEY (domain) ) TYPE=MyISAM;
 
    PRIMARY KEY (domain) ) TYPE=MyISAM;
CREATE TABLE forwardings (
 
    source        VARCHAR(80) NOT NULL,
CREATE TABLE forwardings (
    destination  TEXT NOT NULL,
    source        VARCHAR(80) NOT NULL,
    destination  TEXT NOT NULL,
    PRIMARY KEY (source) ) TYPE=MyISAM;
 
    PRIMARY KEY (source) ) TYPE=MyISAM;
CREATE TABLE users (
 
    emailaddr    VARCHAR(80) NOT NULL,
CREATE TABLE users (
    passwd        VARCHAR(30) NOT NULL,
    emailaddr    VARCHAR(80) NOT NULL,
    passwd        VARCHAR(30) NOT NULL,
    PRIMARY KEY (emailaddr) ) TYPE=MyISAM;
 
    PRIMARY KEY (emailaddr) ) TYPE=MyISAM;
CREATE TABLE relaydomains (
 
    rdomain      VARCHAR(80) NOT NULL,
CREATE TABLE relaydomains (
    transport    VARCHAR(80) NOT NULL,
    rdomain      VARCHAR(80) NOT NULL,
    transport    VARCHAR(80) NOT NULL,
    PRIMARY KEY (rdomain) ) TYPE=MyISAM;
 
    PRIMARY KEY (rdomain) ) TYPE=MyISAM;
FLUSH PRIVILEGES;
 
FLUSH PRIVILEGES;

Revision as of 22:04, 30 October 2008

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;