PostgreSQL 2018(1)Installation and Introduction
First of all, I plan to install the current latest version on my MAC. PostgreSQL-10.3-1-osx64-bigsql.dmg
I download it from here https://www.postgresql.org/download/
PostgreSQL - relation database; psql - Command line tool; pgAdmin - GUI tool
Try to install from the source, https://www.postgresql.org/ftp/source/v10.3/
> ./configure --prefix=/Users/hluo/tool/postgresql-10.3
> make
> make install
Make and Install the tools under Contrib
> cd contrib/
> make
> make install
Put the software in Path
> sudo ln -s /Users/hluo/tool/postgresql-10.3 /opt/postgresql-10.3
> sudo ln -s /opt/postgresql-10.3 /opt/postgresql
Verify the installation
> postgres --version
postgres (PostgreSQL) 10.3
Init the Data Directory
> initdb -D /opt/postgresql/data/
Start and stop the database with command
> pg_ctl -D /opt/postgresql/data/ -l logfile start
waiting for server to start.... done
server started
List the database we have
> psql -l
List my system users
> ls /Users
Shared hluo lifesize
Create a user posters
Create a demo database
> createdb -Opostgres -Eutf-8 demo
Connect to the demo database
> psql -U postgres -d demo -h localhost -p 5432
psql (10.3)
Type "help" for help.
demo=>
List all database
demo=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-------------------
demo | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | hluo | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
Create Table and Insert Data
> demo=> create table usertable(name VARCHAR(20), signupdate DATE);
CREATE TABLE
demo=> insert into usertable (name, signupdate ) values ('sillycat', '2018-05-03' );
INSERT 0 1
demo=> select * from usertable;
name | signupdate
----------+------------
sillycat | 2018-05-03
(1 row)
List all tables
> \d
List of relations
Schema | Name | Type | Owner
--------+-----------+-------+----------
public | usertable | table | postgres
Description of one table
> \d usertable
Table "public.usertable"
Column | Type | Collation | Nullable | Default
------------+-----------------------+-----------+----------+---------
name | character varying(20) | | |
signupdate | date | | |
List my current connection
> \conninfo
You are connected to database "demo" as user "postgres" on host "localhost" at port "5432".
Exit from the command line
>\q
Use the UI Tool
https://www.pgadmin.org/download/pgadmin-4-macos/
Install PGAdmin on MAC
Open the app, it will open a browser page http://127.0.0.1:63869/browser/
Host = localhost, Username = postgres, password = postgres, database = postgres.
Query Tool, we can put query SQL there.
References:
http://sillycat.iteye.com/blog/2035746
http://sillycat.iteye.com/blog/2421923
https://www.postgresql.org/
https://www.jianshu.com/p/fedda9824f6a
https://blog.windrunner.me/postgres/
https://jin-yang.github.io/post/postgresql-introduce.html
http://postgresapp.com/
http://postgresapp.com/documentation/cli-tools.html
https://www.yiibai.com/postgresql/2013080439.html
分享到:
相关推荐
《PostgreSQL介绍与概念》由Bruce Momjian撰写,是一本深入探讨PostgreSQL数据库管理系统的核心原理、功能特性和管理技巧的专业书籍。此书不仅适合初学者了解PostgreSQL的基础知识,也适用于经验丰富的数据库管理员...
1. **历史背景**:介绍了PostgreSQL的起源和发展历程,从其最初的开发背景到成为当前广受欢迎的数据库系统的过程。 2. **基础知识**:为初学者提供了PostgreSQL的基本概念和技术要点,帮助读者快速入门。 3. **核心...
Addison.PostgreSQL.Introduction.and.Concepts
PPT PG PostgreSQL 生态圈 GP PostgreSQL pg2018中国大会PPT合集
The book covers PostgreSQL from a data architect's perspective – covering topics from installation from source to designing tables using SQL Power Architect, as well as deciding replication and ...
赠送jar包:postgresql-42.3.1.jar; 赠送原API文档:postgresql-42.3.1-javadoc.jar; 赠送源代码:postgresql-42.3.1-sources.jar; 赠送Maven依赖信息文件:postgresql-42.3.1.pom; 包含翻译后的API文档:...
Chapter 1 The Basics Chapter 2 Database Administration Chapter 3 PSQL Chapter 4 PgAdmin III – Graphical GUI Chapter 5 Data Types and other objects Chapter 6 Tables, Constraints, and Indexes Chapter 7...
PostgreSQL是一款功能强大的开源对象关系数据库管理系统(ORDBMS),它源自1986年加利福尼亚大学伯克利分校的POSTGRES项目。PostgreSQL继承了POSTGRES的核心技术,并在九十年代中期得到了快速发展和广泛应用。Bruce ...
**PostgreSQL 9.5.2-1** 是一个重要的关系型数据库管理系统版本,它在PostgreSQL系列中占据着显著的地位。此版本是专为Windows操作系统设计的,提供了丰富的功能和增强的性能,使得数据库管理和开发更为高效。 ...
【PostgreSQL1】是关于PostgreSQL数据库系统的详细讨论。PostgreSQL,通常简称为Postgres,是一种功能强大的开源对象关系数据库管理系统(ORDBMS),它在数据管理、事务处理和复杂查询方面表现出色。这个标签表明...
postgresql-10.23-1的windows32版本