Alternate output format for psql showing one column per line with column name

I just needed to spend more time staring at the documentation. This command: \x on will do exactly what I wanted. Here is some sample output: select * from dda where u_id=24 and dda_is_deleted=’f’; -[ RECORD 1 ]——+—————————————————————————————————————————————————————————————————————- dda_id | 1121 u_id | 24 ab_id | 10304 dda_type | CHECKING dda_status | PENDING_VERIFICATION dda_is_deleted | … Read more

Psql list all tables

If you wish to list all tables, you must use: \dt *.* to indicate that you want all tables in all schemas. This will include tables in pg_catalog, the system tables, and those in information_schema. There’s no built-in way to say “all tables in all user-defined schemas”; you can, however, set your search_path to a … Read more

PostgreSQL disable more output

To disable pagination but retain the output, use: \pset pager off To remember this setting, add it to your ~/.psqlrc, e.g. like this: echo \\pset pager off >> ~/.psqlrc See the psql manual. On older versions of Pg it was just a toggle, so \pset pager To completely suppress query output, use \o /dev/null in … Read more

Create database from command line

Change the user to postgres : su – postgres Create User for Postgres (in the shell and NOT with psql) $ createuser testuser Create Database (same) $ createdb testdb Acces the postgres Shell psql ( enter the password for postgressql) Provide the privileges to the postgres user $ alter user testuser with encrypted password ‘qwerty’; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)