ODOO 安装 - postgressql create user

在postgresql9.6中创建用户

 

运行psql, 用create role  带login参数才能登录。

先在 pg_hba.conf中的缺省设置下,即有下列设置项(local   all             postgres                                peer)下,通过root用户,进入到postgres 用户下,运行 psql进入postgresql命令行状态,修改postgres的口令,通过以下命令:

alter roll  postgresq password "###############" ;

修改后,再注释掉(local   all             postgres                                peer), 使用 (local  all       all            md5),就能够在任何用户下,运行psql -U username  -d  dbname  -W  进入postgresq 命令行下了,一定要有-d postgres 这个参数。

 

psql -U  username -d postgres -W

 

在用pip install -r requirements.txt --user  安装odoo11时,遇到以下错误,加上 

--user 参数即可。

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/ldapurl.py'
Consider using the `--user` option or check the permissions.

安装linux库扩展:

aptitude  install -y python3.5-dev  python3-postgresql libxml2-dev   libxslt-dev    libevent-dev  libsasl2-dev   libldap2-dev  
 
 aptitude install -y npm
 npm install -g less

ubuntu 16.04    在安装 odoo11.0 时,需做这个安装 aptitude install -y  node-less

 

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

# TYPE DATABASE USER ADDRESS METHOD
local  all      all          peer

to

# TYPE DATABASE USER ADDRESS METHOD
local  all      all          md5
  • peer means it will trust the identity (authenticity) of UNIX user. So not asking for a password.

  • md5 means it will always ask for a password, and validate it after hashing with MD5.

  • trust means it will never ask for a password, and always trust any connection.

You can, of course, also create more specific rules for a specific database or user, with some users having peer and others requiring passwords.

After changing pg_hba.conf you'll need to restart PostgreSQL if it's running. E.g. sudo service postgresql restart

Steps to change/create default postgres user's password:

  1. trust connection by adding in pg_hba.conf file
  • local all postgres trust
  1. Restart postgresql service
  • sudo service postgresql restart
  1. psql -U postgres

  2. At the postgres=# prompt, change the user name postgres password:

  • ALTER USER postgres with password ‘new-password’;
  1. Revert the changes in pg_hba.conf file from trust to md5 and restart postgresql.

* The file pg_hba.conf will most likely be at /etc/postgresql/9.x/main/pg_hba.conf

Source

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值