Cannot connect to database using PostgreSQL locally

65 views
Skip to first unread message

Allan Zhang

unread,
Jan 3, 2017, 4:00:04 AM1/3/17
to tryton
Hi,

I have been unable to connect to the PostgreSQL database with the tryton client.
When creating the profile, it always says "Database: Could not connect to server"

Using tryton/trytond 4.2.0

This is what I have done:
started postgresql-9.5

psql -U postgres
CREATE USER al WITH PASSWORD 'a';
CREATE DATABASE aldb WITH OWNER al;
#GRANT ALL PRIVILEGES ON DATABASE aldb to al;
\q

output for psql -U postgres -c "list"
                     List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges  
-----------+----------+----------+------------+------------+-----------------------
 aldb      | al       | UTF8     | en_CA.utf8 | en_CA.utf8 |
 postgres  | postgres | UTF8     | en_CA.utf8 | en_CA.utf8 |
 template0 | postgres | UTF8     | en_CA.utf8 | en_CA.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_CA.utf8 | en_CA.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
(4 rows)


tryton-admin -c /etc/tryton/trytond.conf -d aldb --all
where /etc/tryton/trytond.conf is:
[database]
uri = postgresql://al:a@localhost/
path = /var/lib/trytond

After I create the database, I open the client. I have tried various hostnames, with and without ports, and various attempts for the uri in the .conf file without luck.

I would appreciate any help! I have been at this for a while.

Thanks,
Allan

Sergi Almacellas Abellana

unread,
Jan 3, 2017, 4:54:06 AM1/3/17
to try...@googlegroups.com, Allan Zhang
Once you have created the database and initialized it, you have to run the server with:

trytond -c <config_file> -d <database>

And then you should be able to connect on port 8000 of localhost.

Hope it helps!

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Reply all
Reply to author
Forward
0 new messages