Database Creation

From Antiflux Wiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 17:47, 15 March 2005

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