1.查看 ubuntu16 提供的 postgresql 版本:apt-cache show postgresql
Ubuntu16安装PostgreSQL
2.安装命令:sudo apt-get install postgresql
Ubuntu16安装PostgreSQL
3.查看版本信息:psql --version
Ubuntu16安装PostgreSQL
4.安装postgrep数据库会默认创建一个用户 postgres 作为数据库的管理员,需要操作数据库需要切换到此用户:sudo su postgres
Ubuntu16安装PostgreSQL
5.查看postgresql已存在的数据库列表:psql -lUbuntu16安装PostgreSQL
6.创建一个名为demo的数据库:createdb demo ,然后重复步骤五

Ubuntu16安装PostgreSQL
到这里,新的数据库就已经建好啦。

7.进入demo数据库并且打开postgresql数据库的命令行:psql demo

Ubuntu16安装PostgreSQL
查看当前系统时间:select now(); # now() 为postgresql提供的系统函数
Ubuntu16安装PostgreSQL
使用内置函数查看版本信息:select version();
Ubuntu16安装PostgreSQL
退出postgresql系统的命令行模式: \q
Ubuntu16安装PostgreSQL
8.删除数据库 demo (非数据库命令行模式): dropdb demo
Ubuntu16安装PostgreSQL
先到这里,后续有必要再更其它的。

相关文章:

  • 2021-10-20
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-05-22
  • 2021-05-03
  • 2021-04-12
  • 2021-09-25
  • 2021-07-26
  • 2021-05-30
相关资源
相似解决方案