- 连接指定的数据库
psql -h 127.0.0.1 -U hppoc -d fabricexplorer -W password -p 5432
输出:
bash-4.4# psql -h 127.0.0.1 -U hppoc -d fabricexplorer -W password -p 5432
psql: warning: extra command-line argument "password" ignored
Password for user hppoc:
psql (10.4)
Type "help" for help.
fabricexplorer=> \dt
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+-------
public | blocks | table | hppoc
public | chaincodes | table | hppoc
public | channel | table | hppoc
public | orderer | table | hppoc
public | peer | table | hppoc
public | peer_ref_chaincode | table | hppoc
public | peer_ref_channel | table | hppoc
public | transactions | table | hppoc
public | users | table | hppoc
public | write_lock | table | hppoc
- 查询表数据
select * from 表名;
输出:
fabricexplorer=> select * from peer;
id | org | channel_genesis_hash | mspid | requests | events | server_hostname | createdt | peer_type | network_name
----+-----+------------------------------------------------------------------+------------+-----------------------------------+--------+-----------------------------------+----------+-----------+--------------
1 | | 191f9c2302a83e6fb39cfc635f0938471d05f55564dafd5f306a1ef1c1902fdd | Org1MSP | peer2.org1.example.com:1051 | | peer2.org1.example.com:1051 | | PEER | network
2 | | 191f9c2302a83e6fb39cfc635f0938471d05f55564dafd5f306a1ef1c1902fdd | OrdererMSP | orderer1.orderer.example.com:7050 | | orderer1.orderer.example.com:7050 | | ORDERER | network
3 | | 191f9c2302a83e6fb39cfc635f0938471d05f55564dafd5f306a1ef1c1902fdd | OrdererMSP | orderer2.orderer.example.com:7050 | | orderer2.orderer.example.com:7050 | | ORDERER | network
4 | | 191f9c2302a83e6fb39cfc635f0938471d05f55564dafd5f306a1ef1c1902fdd | OrdererMSP | orderer3.orderer.example.com:7050 | | orderer3.orderer.example.com:7050 | | ORDERER | network
(4 rows)
fabricexplorer=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------+----------+------------+------------+-----------------------
fabricexplorer | hppoc | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
fabricexplorer=>
fabricexplorer=> \c fabricexplorer
Password for user hppoc:
You are now connected to database "fabricexplorer" as user "hppoc".
fabricexplorer=> \dt
List of relations
Schema | Name | Type | Owner
--------+--------------------+-------+-------
public | blocks | table | hppoc
public | chaincodes | table | hppoc
public | channel | table | hppoc
public | orderer | table | hppoc
public | peer | table | hppoc
public | peer_ref_chaincode | table | hppoc
public | peer_ref_channel | table | hppoc
public | transactions | table | hppoc
public | users | table | hppoc
public | write_lock | table | hppoc
(10 rows)
网友评论