我试图开始学习postgres,因为我花了很多时间(浪费了6-7个小时)来确定如何开始。
有很多教程/博客等,但仍然没有得到我应该做的。
具体我还在尝试使用此https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
eric@eric:~$ sudo apt-get install postgresql postgresql-contrib # succesfully installed version 9.3.5
eric@eric:~$ psql -V
psql (PostgreSQL) 9.3.5
eric@eric:~$ sudo -i -u postgres # switch to user postgres
postgres@eric:~$
现在我尝试使用createdb
命令和其他一些东西创建数据库。但我觉得我陷入困境。
当我尝试更改此用户的密码时,它说
postgres@eric:~$ sudo passwd postgres
[sudo] password for postgres:
Sorry, try again.
[sudo] password for postgres:
Sorry, try again.
[sudo] password for postgres:
Sorry, try again.
sudo: 3 incorrect password attempts
我只想创建一个新用户(带密码)和与之关联的数据库。
有人可以解释设置这些的主要概念和命令 (能够使用这个脚本) http://www.tutorialspoint.com/postgresql/postgresql_python.htm
答案 0 :(得分:0)
为什么不使用 psql ?
postgres @ eric:〜$ psql
postgres #create role USERNAME with LOGIN;
postgres#\ password USERNAME - \ password是推荐在postgresql中更改密码的方法
设置密码
确认密码
稍微补助一下
提示:默认情况下,所有公共成员都可以登录数据库,
但您需要为用户授予对表的操作