PostgreSQL学习第六篇--psql常用连接数据库的方法
发布时间:2020-12-13 17:00:48 所属栏目:百科 来源:网络整理
导读:psql -h hostname or ip -p port [dbname] [username]-h 指定要连接数据库所在的主机名或者IP地址-p 指定连接的数据库端口,最后两个参数是数据库名和用户名。示例:[postgres@single ~]$ psql -h 186.168.100.13 -p 5432 testdb postgrespsql: could not co
psql -h <hostname or ip> -p <port> [dbname] [username] -h 指定要连接数据库所在的主机名或者IP地址 -p 指定连接的数据库端口,最后两个参数是数据库名和用户名。 示例: [postgres@single ~]$ psql -h 186.168.100.13 -p 5432 testdb postgres psql: could not connect to server: Connection refused Is the server running on host "186.168.100.13" and accepting TCP/IP connections on port 5432? [postgres@single ~]$ psql -h localhost -p 5432 testdb postgres psql (9.6.1) Type "help" for help. [postgres@single pgdata]$ vi postgresql.conf listen_addresses = '*' [postgres@single pgdata]$ psql stop psql: FATAL: database "stop" does not exist [postgres@single pgdata]$ pg_ctl stop waiting for server to shut down.... done server stopped [postgres@single pgdata]$ pg_ctl start server starting [postgres@single pgdata]$ LOG: database system was shut down at 2016-11-17 22:08:59 CST LOG: MultiXact member wraparound protections are now enabled LOG: database system is ready to accept connections LOG: autovacuum launcher started [postgres@single pgdata]$ psql -h 186.168.100.13 -p 5432 testdb postgres FATAL: no pg_hba.conf entry for host "186.168.100.13",user "postgres",database "testdb" psql: FATAL: no pg_hba.conf entry for host "186.168.100.13",database "testdb" [postgres@single pgdata]$ vi pg_hba.conf # IPv4 local connections: host all all 186.168.100.13/32 trust [postgres@single pgdata]$ pg_ctl stop LOG: received fast shutdown request LOG: aborting any active transactions LOG: autovacuum launcher shutting down LOG: shutting down waiting for server to shut down....LOG: database system is shut down done server stopped [postgres@single pgdata]$ [postgres@single pgdata]$ pg_ctl start server starting [postgres@single pgdata]$ LOG: database system was shut down at 2016-11-17 22:16:14 CST LOG: MultiXact member wraparound protections are now enabled LOG: database system is ready to accept connections LOG: autovacuum launcher started [postgres@single pgdata]$ [postgres@single pgdata]$ psql -h 186.168.100.13 -p 5432 testdb postgres psql (9.6.1) Type "help" for help. testdb=# (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- Oracle批量导入100万条数据不到1秒
- c# – 隐藏webBrowser控件中的滚动条
- 解决React Native 运行在ios上报'boost/iter
- dojo中AccordionContainer(手风琴)动态添加Con
- ruby-on-rails – Rspec / Rails:未初始化的常量
- ruby-on-rails – 如何使用Amazon SES发送电子邮
- C++拷贝构造函数(复制构造函数)
- xml中用fragment出现Error inflating class frag
- c# – Windows Identity Foundation System.Xml.
- c – 为什么cerr刷新cout的缓冲区
热点阅读