PostgreSQL How to create a library and create a user

Source: Internet
Author: User
Tags postgresql psql create database

Fedora

User

To the operation of the database, first transfer to Postgres user

The first time you want to set a password

sudo passwd postgres

Switch to this user

Su-postgres

Database initialization

The first time to do

initdb/var/lib/pgsql/data/

pg_ctl-d/var/lib/pgsql/data-l logfile Start

PS: Built in the home is better, home space generally give a relatively large, I used to encounter PostgreSQL database space is full of problems

Initdb/home/postgres

pg_ctl-d/home/postgres-l logfile Start

Pure SQL Build User

Psql

Go to SQL command line

CREATE role Gitlab LOGIN ENCRYPTED PASSWORD ' z129854 ' NOINHERIT VALID ' UNTIL ';
CREATE DATABASE gitlabhq_production with encoding= ' UTF8 ' Owner=gitlab;

Creating a database (recommended for pure SQL)

Then enter:

Createdb Bigzhu

The library is placed in the/var/lib/postgresql/8.4/main/base but is not removable.

Establish database user (recommended pure SQL)

Go to SQL Editor

Psql Bigzhu

Create a user

CREATE user username with PASSWORD ' password ';
CREATE USER bigzhu with PASSWORD ' password ';
CREATE USER redmine with PASSWORD ' password ';


Delete Database

Dropdb Bigzhu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.