PostgreSQL

PostgreSQL connect to database using psql

To connect to PostgreSQL database server using psql command line, run If you have a PostgreSQL user and password, you

postgresql.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files

postgresql.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files

When i restart postgresql, i get following error This is because you are running the command as user postres. Login

PostgreSQL

PostgreSQL Export table into CSV file

To export a table into CSV file, run This will save the CSV file in current directory.

PostgreSQL

PostgreSQL List all databases

To list all databases in PostgreSQL database, first connect to PostgreSQL database using psql command Now run This will list

PostgreSQL Create Database

PostgreSQL Create Database

To create a database, run Creating user, grant permissions Creating a User and Database using psql

PostgreSQL drop database

PostgreSQL Delete a Database

To delete a PostgreSQL database, run Example

pg_ctl

pg_ctl

pg_ctl is used to start, stop PostgreSQL server. To start PostgreSQL, run You can also use stop/restart. PostgreSQL