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管理和开发的一本很好的参考书籍
学习数据库和PostgreSQL的入门书籍
Addison.PostgreSQL.Introduction.and.Concepts
PostgreSQL.Up.and.Running.2nd.Edition.2014.12.pdf
PostgreSQL- Up and Running.pdf
PostgreSQL1 PostgreSQL1
PPT PG PostgreSQL 生态圈 GP PostgreSQL pg2018中国大会PPT合集
赠送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文档:...
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 ...
开源数据库PostgreSQL,动物园出的教材,值得推荐,值得品味,
A practical guide to administer, monitor and replicate your PostgreSQL 10 database Key Features Get to grips with the capabilities of PostgreSQL 10 to administer your database more efficiently ...
PostgreSQL is an open source relational database management system that began as a research project at the University of California, Berkeley. It was originally released under the BSD license but now ...
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 up and running pdf
PostgreSQL数据库入门必读,非常经典的一本数据库教程。
Mastering PostgreSQL 10 Expert techniques on PostgreSQL 10 development and administration 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
PostgreSQL is a rock-solid, scalable, and safe enterprise-level relational database. With a broad range of features and stability, it is ever increasing in popularity.This book shows you how to take ...
It starts with an introduction to DBaaS and IaaS and a brief description of the criteria considered by organizations when deploying databases as a service. We talk about the major concerns and issues...
PostgreSQL-Up-and-Running-A-Practical-Guide-to-the-Advanced-Open-Source-Database,数据库课本 如题所示 全本pdf版本
This clear, fast-paced introduction helps you understand and use this open source database system. Not only will you learn about the enterprise class features in versions 9.2, 9.3, and 9.4, you'll ...