{"id":1370,"date":"2025-03-16T10:56:10","date_gmt":"2025-03-16T02:56:10","guid":{"rendered":"http:\/\/113.45.254.23\/?p=1370"},"modified":"2025-03-16T10:56:11","modified_gmt":"2025-03-16T02:56:11","slug":"%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8postgresql","status":"publish","type":"post","link":"http:\/\/113.45.254.23\/?p=1370","title":{"rendered":"\u5b89\u88c5\u548c\u4f7f\u7528PostgreSQL"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001\u5b89\u88c5pgsql\u6570\u636e\u6e90<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# sudo dnf install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-9-x86_64\/pgdg-redhat-repo-latest.noarch.rpm    \u5b89\u88c5pgsql\u6570\u636e\u6e90<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u6570\u636e\u5e93\u53ca\u67e5\u770bpgsql\u6570\u636e\u5217\u8868<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# dnf -y install postgresql17-server postgresql17-contrib \u5b89\u88c5pgsql17\u7248\u672c\u7684\u6570\u636e\u5e93\n&#91;root@server10 ~]# dnf repolist\t\t\t\t\t\u67e5\u770bpgsql\u6570\u636e\u5217\u8868\nrepo id             repo name\nappstream           Rocky Linux 9 - AppStream\nbaseos              Rocky Linux 9 - BaseOS\nextras              Rocky Linux 9 - Extras\npgdg-common         PostgreSQL common RPMs for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg12              PostgreSQL 12 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg13              PostgreSQL 13 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg14              PostgreSQL 14 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg15              PostgreSQL 15 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg16              PostgreSQL 16 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64\npgdg17              PostgreSQL 17 for RHEL \/ Rocky \/ AlmaLinux 9 - x86_64<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u521d\u59cb\u5316\u5b89\u88c5\u6570\u636e\u5e93\u53ca\u542f\u52a8\u6570\u636e\u5e93<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# postgresql-17-setup initdb\t\t\t\t\u521d\u59cb\u5316\u5b89\u88c5\u6570\u636e\u5e93\t\t\t\nInitializing database ... OK\n\n&#91;root@server10 ~]# systemctl start postgresql-17\t\t\t\t\t\u542f\u52a8\u6570\u636e\u5e93\n&#91;root@server10 ~]# \n&#91;root@server10 ~]# systemctl enable postgresql-17\t\t\t\t\u8bbe\u7f6e\u6570\u636e\u5e93\u5f00\u673a\u542f\u52a8<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u67e5\u770b\u6240\u6709\u7aef\u53e3<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]#  netstat -tunlp \t\t\t\t\t\t\t\t\u67e5\u770b\u6240\u6709\u7aef\u53e3\nActive Internet connections (only servers)\nProto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name    \ntcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      816\/sshd: \/usr\/sbin \ntcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      2425\/postgres       \u770b\u8fd9\u4e2a\ntcp6       0      0 :::22                   :::*                    LISTEN      816\/sshd: \/usr\/sbin \ntcp6       0      0 ::1:5432                :::*                    LISTEN      2425\/postgres       \n&#91;root@server10 ~]# netstat -tunlp | grep postgre\t\t\t\t\t\u67e5\u770bpgsql\u7684\u7aef\u53e3\ntcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      2425\/postgrs       \ntcp6       0      0 ::1:5432                :::*                    LISTEN      2425\/postgrs<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u542f\u52a8\u9632\u706b\u5899\u53ca\u5728\u9632\u706b\u5899\u91cc\u6dfb\u52a0pgsql\u7684\u7aef\u53e3<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# systemctl enable --now firewalld\t\t\t\t\u542f\u52a8\u9632\u706b\u5899\u5e76\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\nCreated symlink \/etc\/systemd\/system\/dbus-org.fedoraproject.FirewallD1.service \u2192 \/usr\/lib\/systemd\/system\/firewalld.service.\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/firewalld.service \u2192 \/usr\/lib\/systemd\/system\/firewalld.service.\n&#91;root@server10 ~]# \n&#91;root@server10 ~]# firewall-cmd --add-port=5432\/tcp\t\t\t\t\u5728\u9632\u706b\u5899\u91cc\u6dfb\u52a05432\u7aef\u53e3\t\nsuccess\n&#91;root@server10 ~]# firewall-cmd --runtime-to-permanent\t\t\t\u5728\u9632\u706b\u5899\u91cc\u6c38\u4e45\u6dfb\u52a0\u8fd0\u884c\u65f6<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u767b\u5f55pgsql\u6570\u636e\u5e93\u53ca\u67e5\u770b\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\u3001\u67e5\u770b\u8fde\u63a5\u4fe1\u606f\u3001\u67e5\u770b\u5bc6\u7801\u7684\u52a0\u5bc6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# sudo -u postgres psql\t\t\t\t\t\t\u767b\u5f55\u6570\u636e\u5e93\npsql (17.4)\nType \"help\" for help.\n\npostgres=# show hba_file;\t\t\t\t\t\t\t\t\t\t\u67e5\u770b\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6\u7684\u4f4d\u7f6e\n              hba_file              \n------------------------------------\n \/var\/lib\/pgsql\/17\/data\/pg_hba.conf\t\t\t\t\t\t\t\t\u8fd9\u91cc\u662f\u4f4d\u7f6e\n(1 row)\npostgres=# show password_encryption;\t\t\t\t\t\t\t\u67e5\u770b\u5bc6\u7801\u7684\u52a0\u5bc6\n password_encryption \n---------------------\n scram-sha-256\t\t\t\t\t\t\t\t\t\t\t\t\u52a0\u5bc6\u7b97\u6cd5 \u957f\u5ea6256\n(1 row)\npostgres=# \\conninfo\t\t\t\t\t\t\t\t\t\t\t\u67e5\u770b\u8fde\u63a5\u4fe1\u606f\nYou are connected to database \"postgres\" as user \"postgres\" via socket in \"\/run\/postgresql\" at port \"5432\".\t\t\tdatabase \"postgres\"\u6570\u636e\u5e93\u540d\u79f0postgres\t\tuser \"postgres\" \u6570\u636e\u5e93\u7ba1\u7406\u5458postgres\npostgres=# \npostgres=# \\q\t\t\t\t\t\t\t\t\t\t\t\t\u9000\u51fa\u6570\u636e\u5e93<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u521b\u5efa\u6570\u636e\u5e93\u7528\u6237<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">7.1 \u521b\u5efaalice\u6570\u636e\u5e93\uff0c\u7528\u6237\u4e3aalice<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# sudo -u postgres psql\t\t\t\t\u7528\u6570\u636e\u5e93\u7ba1\u7406\u5458\u672c\u5730\u767b\u5f55\u6570\u636e\u5e93\npsql (17.4)\nType \"help\" for help.\n\npostgres=# create user alice with createdb createrole password 'P4ssw0rdAlice';\t\u6388\u6743alice\u7528\u6237\u521b\u5efa\u6570\u636e\u5e93\t\u521b\u5efaalice\u7528\u6237\uff0c\u5e76\u8bbe\u7f6e\u5bc6\u7801\u4e3aP4ssw0rdAlice\t\tcreaterole\u521b\u5efa\u89d2\u8272 \nCREATE ROLE\npostgres=# CREATE DATABASE alice OWNER alice;\t\t\t\t  \u521b\u5efaalice\u6570\u636e\u5e93\uff0c\u7528\u6237\u4e3aalice\nCREATE DATABASE<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7.2 \u521b\u5efatestdb\u6570\u636e\u5e93\uff0c\u7528\u6237\u4e3atestdb<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres=# CREATE DATABASE testdb OWNER alice;\t\t\t\t\u521b\u5efatestdb\u6570\u636e\u5e93\uff0c\u7528\u6237\u4e3aalice\n\nCREATE DATABASE<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7.3 \u5217\u51fa\u6570\u636e\u5e93\u4e2d\u6240\u6709\u89d2\u8272<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres=# \\l\t\t\t\t\t\t\t\u7528\u4e8e\u5217\u51fa\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u53ef\u7528\u7684\u6570\u636e\u5e93\n                                                     List of databases\n   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | IC\nU Rules |   Access privileges   \n-----------+----------+----------+-----------------+-------------+-------------+--------+---\n--------+-----------------------\n alice     | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n testdb    | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n(5 rows)\npostgres=#\\q<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u516b\u3001Alice\u7528\u6237\u767b\u5f55\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# sudo -u postgres psql -U alice -h 127.0.0.1  Alice\u7528\u6237\u767b\u5f55\u6570\u636e\u5e93\nPassword for user alice: \t\t\t\t\t\tP4ssw0rdAlice\npsql (17.4)\nType \"help\" for help.\n\nalice=> \\conninfo\nYou are connected to database \"alice\" as user \"alice\" on host \"127.0.0.1\" at port \"5432\".\nalice=> \\l\n                                                     List of databases\n   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | IC\nU Rules |   Access privileges   \n-----------+----------+----------+-----------------+-------------+-------------+--------+---\n--------+-----------------------\n alice     | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n testdb    | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n(5 rows)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e5d\u3001Alice\u7528\u6237\u8fde\u63a5testdb\u6570\u636e\u5e93<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">9.1 Alice\u7528\u6237\u8fde\u63a5testdb\u6570\u636e\u5e93<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>alice=> \\connect testdb;   \u8fde\u63a5testdb\u6570\u636e\u5e93\nYou are now connected to database \"testdb\" as user \"alice\".\ntestdb=> create table users (\t\t\t\u521b\u5efa\u7528\u6237\u8868\ntestdb(> id int primary key not null,\t\tid\u4e3a\u6574\u6570\u7c7b\u578b \u8bbe\u7f6e\u4e3a\u7ec4\u4ef6\uff0c\u4e0d\u5141\u8bb8\u4e3a\u7a7a\ntestdb(> name text not null,\t\t\t\u540d\u5b57\u4e3a\u6587\u672c\u7c7b\u578b\uff0c\u4e0d\u5141\u8bb8\u4e3a\u7a7a\ntestdb(> age int not null,\t\t\t\t\u5e74\u9f84\u4e3a\u6574\u6570\u7c7b\u578b\uff0c\u4e0d\u5141\u8bb8\u4e3a\u7a7a\ntestdb(> address char(50),\t\t\t\t\u5730\u5740\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u957f\u5ea6\u4e3a50\ntestdb(> salary real );\t\t\t\t\t\u85aa\u6c34\u4e3a\u6d6e\u70b9\u6570 \u540e\u8fb9\nCREATE TABLE<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9.2 \u5217\u51fa\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u6240\u6709\u53ef\u89c1\u7684\u8868<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=> \\dt\t\t\t\t\t\t\t\u7528\u4e8e\u5217\u51fa\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u6240\u6709\u53ef\u89c1\u7684\u8868\n       List of relations\n Schema | Name  | Type  | Owner \n--------+-------+-------+-------\n public | users | table | alice\n(1 row)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">10\u3001\u5411\u7528\u6237\u8868\u4e2d\u63d2\u5165\u6570\u636e\u53ca\u67e5\u8be2\u3001\u66f4\u6539\u7528\u6237\u8868<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">10.1 \u5411\u7528\u6237\u8868\u4e2d\u63d2\u5165\u6570\u636e<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=> insert into users (id,name,age,address,salary) values (1,'tom',32,'Beijing',20000.00);\nINSERT 0 1\t\t\u5411\u7528\u6237\u8868\u4e2d\u63d2\u5165\u6570\u636e id=1 \u540d\u5b57\uff1atom \u5e74\u9f84\uff1a32 \u5730\u5740\uff1a\u5317\u4eac  20000.00    .00 \u662f\u6d6e\u70b9\u6570\ntestdb=> insert into users (id,name,age,address,salary) values (2,'jack',26,'Shanghai',10000.00);\nINSERT 0 1\ntestdb=> insert into users (id,name,age,address,salary) values (3,'jobs',28,'hangzhou',10000.00);\nINSERT 0 1\ntestdb=> select * from users;\t\t\t\u67e5\u8be2\u7528\u6237\u8868\u4e2d\u7684\u6240\u6709\u5185\u5bb9\n id | name | age |                      address                       | salary \n----+------+-----+----------------------------------------------------+--------\n  1 | tom  |  32 | Beijing                                            |  20000\n  2 | jack |  26 | Shanghai                                           |  10000\n  3 | jobs |  28 | hangzhou                                           |  10000\n(3 rows)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">10.2 \u67e5\u8be2\u7528\u6237\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=> select name,age,salary from users;\t\t\u67e5\u8be2\u7528\u6237\u8868\u4e2d\u7684\u540d\u5b57\u3001\u5e74\u9f84\u548c\u85aa\u6c34\n name | age | salary \n------+-----+--------\n tom  |  32 |  20000\n jack |  26 |  10000\n jobs |  28 |  10000\n(3 rows)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10.3 \u66f4\u6539\u7528\u6237\u8868<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=> update users set address = 'Shenzhen' where name='jobs';\t\t\u5c06\u540d\u5b57\u662fjobs\u7528\u6237\u7684\u5730\u5740\u66f4\u6539\u4e3a\u6df1\u5733\nUPDATE 1\ntestdb=> select * from users;\t\t\t\t\t\t\t\t\t\t\u67e5\u8be2\u7528\u6237\u8868\u7684\u6240\u6709\u5185\u5bb9\n id | name | age |                      address                       | salary \n----+------+-----+----------------------------------------------------+--------\n  1 | tom  |  32 | Beijing                                            |  20000\n  2 | jack |  26 | Shanghai                                           |  10000\n  3 | jobs |  28 | Shenzhen                                           |  10000\n(3 rows)\n\ntestdb=> \\q\t<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">11 \u767b\u5f55\u3001\u67e5\u770b\u6570\u636e\u5e93\u53ca\u5220\u9664\u8868\u3001\u6570\u636e\u5e93<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">11.1 \u767b\u5f55\u6570\u636e\u5e93<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@server10 ~]# sudo -u postgres psql\t\t\t\t\t\t\t\u767b\u5f55\u6570\u636e\u5e93\npsql (17.4)\nType \"help\" for help.\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">11.2 \u67e5\u770b\u6570\u636e\u5e93<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">postgres=# \\l\t\t\t\t\t\t\t\t\t\t\t\t\t\u67e5\u770b\u6570\u636e\u5e93<br>                                                     List of databases<br>   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | IC<br>U Rules |   Access privileges   <br>&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;<br>&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br> alice     | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   <br>        | <br> postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   <br>        | <br> template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   <br>        | =c\/postgres          +<br>           |          |          |                 |             |             |        |   <br>        | postgres=CTc\/postgres<br> template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   <br>        | =c\/postgres          +<br>           |          |          |                 |             |             |        |   <br>        | postgres=CTc\/postgres<br> testdb    | alice    | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   <br>        | <br>(5 rows)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">11.3 \u8fde\u63a5testdb\u6570\u636e\u5e93\u53ca\u5220\u9664testdb\u6570\u636e\u5e93\u91cc\u7684\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres=# \\connect testdb;\t\t\t\t\t\t\u8fde\u63a5testdb\u7684\u6570\u636e\u5e93\nYou are now connected to database \"testdb\" as user \"postgres\".\ntestdb=# drop table users;\t\t\t\t\t\t\t\u5220\u9664\u7528\u6237\u8868\nDROP TABLE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">11.4 \u5217\u51fa\u5f53\u524d\u6570\u636e\u5e93\u53ef\u89c1\u7684\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=# \\dt\t\t\t\t\t\t\t\t\t\t\u5217\u51fa\u5f53\u524d\u6570\u636e\u5e93\u53ef\u89c1\u7684\u8868\nDid not find any relations.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">12 \u8fde\u63a5\u4e3b\u6570\u636e\u5e93<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">12.1 \u8fde\u63a5\u4e3b\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>testdb=# \\connect postgres\t\t\t\t\t\t\u8fde\u63a5\u4e3b\u6570\u636e\u5e93\nYou are now connected to database \"postgres\" as user \"postgres\".<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">12.2 \u5220\u9664alice\u53catestdb\u6570\u636e\u5e93<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">postgres=# drop database alice;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5220\u9664alice\u6570\u636e\u5e93<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DROP DATABASE<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">postgres=# drop database testdb;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5220\u9664testdb\u6570\u636e\u5e93<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DROP DATABASE<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">12.3 \u67e5\u770b\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres=# \\l\t\t\t\t\t\t\t\t\t\u67e5\u770b\u6570\u636e\u5e93\n                                                     List of databases\n   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | IC\nU Rules |   Access privileges   \n-----------+----------+----------+-----------------+-------------+-------------+--------+---\n--------+-----------------------\n postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | \n template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |   \n        | =c\/postgres          +\n           |          |          |                 |             |             |        |   \n        | postgres=CTc\/postgres\n(3 rows)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5b89\u88c5pgsql\u6570\u636e\u6e90 \u4e8c\u3001\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684\u6570\u636e\u5e93\u53ca\u67e5\u770bpgsql\u6570\u636e\u5217\u8868 \u4e09\u3001\u521d\u59cb\u5316\u5b89\u88c5\u6570\u636e\u5e93\u53ca\u542f\u52a8\u6570\u636e\u5e93  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[7],"class_list":["post-1370","post","type-post","status-publish","format-standard","hentry","category-linux","tag-pgsql"],"_links":{"self":[{"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/posts\/1370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/113.45.254.23\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1370"}],"version-history":[{"count":1,"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1371,"href":"http:\/\/113.45.254.23\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions\/1371"}],"wp:attachment":[{"href":"http:\/\/113.45.254.23\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/113.45.254.23\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/113.45.254.23\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}