Create.vmail.sql: Difference between revisions
Jump to navigation
Jump to search
m (limited vmal_admin rights) |
(Updated to MySQL5.0, InnoDB and relational tables) |
||
Line 14: | Line 14: | ||
'vmail_admin', | 'vmail_admin', | ||
'Y' | 'Y' | ||
); | ); | ||
-- Make sure that priviliges are reloaded. | -- Make sure that priviliges are reloaded. | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
-- | -- You should drop a pre-existing "vmail" | ||
-- database manually to avoid CREATE errors. | |||
CREATE DATABASE vmail; | CREATE DATABASE vmail; | ||
USE vmail; | USE vmail; | ||
CREATE TABLE | CREATE TABLE virtual_domains ( | ||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, | |||
vdomain VARCHAR(50) NOT NULL | |||
) ENGINE = InnoDB; | |||
PRIMARY KEY ( | CREATE TABLE relaydomains ( | ||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, | |||
relaydomain VARCHAR(80) NOT NULL, | |||
transport VARCHAR(80) NOT NULL | |||
) ENGINE = InnoDB; | |||
CREATE TABLE virtual_users ( | |||
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | |||
domain_id INT(11) NOT NULL, | |||
user VARCHAR(40) NOT NULL, | |||
passwd VARCHAR(32) NOT NULL | |||
) ENGINE = InnoDB; | |||
CREATE TABLE | CREATE TABLE virtual_aliases ( | ||
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | |||
domain_id INT(11) NOT NULL, | |||
source VARCHAR(80) NOT NULL, | source VARCHAR(80) NOT NULL, | ||
destination | destination VARCHAR(80) NOT NULL, | ||
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE | |||
) ENGINE = InnoDB; | |||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; |
Revision as of 01:01, 31 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; -- You should drop a pre-existing "vmail" -- database manually to avoid CREATE errors. CREATE DATABASE vmail; USE vmail; CREATE TABLE virtual_domains ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, vdomain VARCHAR(50) NOT NULL ) ENGINE = InnoDB; CREATE TABLE relaydomains ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, relaydomain VARCHAR(80) NOT NULL, transport VARCHAR(80) NOT NULL ) ENGINE = InnoDB; CREATE TABLE virtual_users ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, domain_id INT(11) NOT NULL, user VARCHAR(40) NOT NULL, passwd VARCHAR(32) NOT NULL ) ENGINE = InnoDB; CREATE TABLE virtual_aliases ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, domain_id INT(11) NOT NULL, source VARCHAR(80) NOT NULL, destination VARCHAR(80) NOT NULL, FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE = InnoDB; FLUSH PRIVILEGES;