PostgreSQL configuration

On a GNU/Linux system, Odoo works very well with the default values of psycopg2 that the Python module used to access a PostgreSQL database:

  • Passwordless authentication if the database user has the same name as the current user on local connections
  • Local connection uses Unix domain sockets
  • The database server listens on port 5432

In that case, there is nothing special to do; we use the postgres administrative user to create a database user who shares our login name and gives it the right to create new databases. We then create a new database with the same name as the new user, which will be used as a default database when using the psql command.

When on a development server, it is okay to give the PostgreSQL user more rights and to use the --superuser command-line option rather than just --createdb. The net effect is that this user can then also create other users and globally manage the database instance. If you feel that --superuser is too much, you may still want to use --createrole in addition to --createdb when creating your database user. Avoid doing this on production servers as it will give additional leverage to an attacker exploiting a vulnerability in some part of the deployed code (refer to Chapter 3, Server Deployment).

If you want to use a database user with a different login, you will need to provide a password for the user. This is done by passing the --pwprompt flag on the command line when creating the user, in which case the command will prompt you for the password.

If the user has already been created and you want to set a password (or modify a forgotten password), you can use the following command:

$ psql -c "alter role $(whoami) with password 'newpassword'"
If this command fails with an error message saying that the database does not exist, it is because you did not create a database named after your login name in step 3. That's fine; just add the --dbname option with an existing database name, such as --dbname template1.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.33.157