Real Programmers/ Cheat Sheet/ MySQL/ New Db And User
Google site:

Creating a new database and user(s)

NB root here is the MySQL root, not the system root.

mysql -uroot -p <<MYSQL
Enter password:

drop database if exists mail;
create database mail;

# Privileges are contained in the 'mysql' database.
use mysql;

# The 'identified by' clauses specify passwords for the user@host
# given in the 'to' clauses. Here we create a admin-type role 'mail', and a
# read-only role 'exim'.
grant Select, Insert, Update, Delete, Create, Drop
        on mail.*
        to mail@localhost
        identified by 'mail_setup';
grant Select
        on mail.*
        to exim@localhost
        identified by 'themta';

All non-user content and code Copyright © 2000-2006 / Paul Makepeace. Comments & feedback welcome!