PostgreSQL Database creation/deletion

Source: Internet
Author: User
Tags postgresql psql postgres database
Method 1-System commands
sudo su-postgres #切换到postgres用户 (System user)
Createdb Weichen #创建数据库
Psql #直接訪问数据库 (default into local postgres database)
\l--View Database list
: Q--Exit list page
\q--Exit client
dropdb Weichen #删除数据库

Method 2-psql Command Line
Sudo-u Postgres Psql #登录client
Create Database Weichen; --Create a database
Create database sz owner Postgres; --Create a database
Select Oid,datname from Pg_database; --View the list of databases
Drop database Weichen; --Delete Database
Drop database sz; --Delete Database

PostgreSQL Database creation/deletion

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.