PostgreSQL学习笔记(1)

安装psql

brew install postgresql

启动服务

brew services start postgresql

使用psql进入控制台,报错:

psql: FATAL:  database "<user>" does not exist

 

看来是没有给我的当前用户创建数据库,使用下面命令进入名为template1的数据库试试

psql -d template1

psql (11.1)
Type "help" for help.

template1=#

一切正常,接下来建立数据库试试。

createdb

再使用psql进入数据库

psql (11.1)
Type "help" for help.

<user>=#

 OK,现在数据库已经建立好了

posted @ 2019-02-15 17:04  Big_Lazy_Cat  阅读(153)  评论(0编辑  收藏  举报