I recently started learning psql, right now I was trying to import some csv spreadsheets into a PostgresQL database using the COPY command.
As far as I know, after installing psql, we have a new account in the system called postgres, and every time I need to use postgres I should sudo -iu to the postgres account and then do psql.
Then I was trying to copy those csv files into the data directory of postgres. I used my account but found that I cannot access the postgres data directory. What I meant by “cannot access” is that when I type cd, nothing happened.
[azure@myVM ~]$ cd /var/lib/pgsql/13/ -bash: cd: /var/lib/pgsql/13/: Permission denied [azure@myVM ~]$ sudo cd /var/lib/pgsql/ [azure@myVM ~]$
I wish to know what is the “normal” way to import data? Because I guess if I am doing everything in a standard way I shouldn’t be going around modifying user access for directories. The machine I am using is a Centos VM from Microsoft azure, and the Postgres version is 13.