Database Creation

From Antiflux Wiki

Revision as of 19:04, 29 September 2007 by Tim (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

MySQL

To create a database called "foo" for the user "bar":

  1. mysqladmin create foo
  2. in mysql(1): grant all on foo.* to bar@localhost identified by 'password'

You can get a password from pwgen(1). If the user already exists in the MySQL user database, you can omit the 'identified by' bit.

PostgreSQL

The user can run createdb foo themselves. To create the database for them, use sudo -u bar createdb foo.

Like MySQL, PostgreSQL has its own user database, but passwords are not necessary for its ident authentication. /usr/local/sbin/adduser.local creates a new Postgres user for each new system user.

Personal tools