I am trying to create and use a new database in postgres. When I try to load the db with the command below:
sudo -u postgres psql
I get this error.
could not change directory to "/home/laptop/Dropbox/js/hw/Has-Many-Relationships": Permission denied psql (9.3.13) Type "help" for help.
I have tried to change the folder permissions in nautilus as root. This command will work as expected when the folder is changed to root (cp and cd /) Any ideas?
You can now locate the Postgres Database files by navigating the directory that was displayed. However, the PostgreSQL configuration directory in Ubuntu is located in /etc/postgresql/10/main .
It sounds like your shell's CWD (Current Working Directory) is
/home/laptop/Dropbox/js/hw/Has-Many-Relationships
and that the 'postgres' user does not have access to that directory.
However, by the next line, you DO seem to be able to talk to a running PostgreSQL server, though you don't share the next line.
This may be helpful if this is a "completely throwaway" database instance on your local machine (laptop):
http://johnmee.com/how-to-reinstall-postgresql-on-ubuntu
This method will completely purge all postgres packages (not just the virtual package) and allow you to start over with a fresh install of PostgreSQL.
Once you've got a clean install of PostgreSQL, try this, as root:
# cd ~postgres/
# sudo -u postgres psql
And see if the error does not repeat.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With