More on this can be found in âFATAL: Ident authentication failedâ, or how cool ideas get bad usage schemas. Either change "ident" in the pg_hba.conf to "md5" or "trust" and restart postgres, or just do what it wants: "sudo -u postgres psql". Specifying the user on the command line "psql -U postgres" doesn't help. What the 'ident' means is postgres uses your shell account name to log you in. You might see a line that looks like this: local all all ident PostgreSQL est un système de gestion de base de données relationnelle et objet (SGBDRO). Deutsch (German) 3 Pages (0) PostgreSQL Cheat Sheet. sudo cat /etc/postgresql/9.0/main/pg_hba.conf development, sql, database, server, postgresql. Ask Postgres where this file is by typing, "show hba_file ". FATAL: Ident authentication failed for user "postgres" If you seen an Ident authentication error. Select setval('my_table_id_seq',1,false) Trouble-shooting Sequences can be manipulated with currval and setval. Cheat Sheet Start the postgres server Connect with the psql client Initialize a database with a password Add and secure remote users Add or update a users. TruncateÄelete all data from a table and related tables. SQL dump and restore pg_dump -U postgres dbname | gzip > dbname.dump.2011.10.24.gz gunzip < dbname.dump.2011.10.24.gz | sudo -u postgres psql -dbname dbnameįor more, see Backup and Restore from the Postgres manual. Grant all privileges on all sequences in schema public to joe_mamma If you use Postgres.app for MacOS, from the terminal you can run psql followed by the default database name: psql -d postgres. Once inside enter the PostgreSQL console with: psql. To do so become the user postgres from the command line with: sudo su - postgres. Grant all privileges on all tables in schema public to joe_mamma First of all you want to login into the console. Grant all privileges on database dbname to joe_mamma Granting access privileges create database dbname Ĭreate user joe_mamma with password 'password' \d lists tables, views and sequences, \dt lists tables. Type \l to list databases and \c to connect to a database. Opening PostgreSQL console: psql -h -U .Postgres commands start with a backslash '\' character. For more detailed cheat sheets there are a plenty good links at the bottom of this post. ![]() To shutdown sudo su postgres -c 'pg_ctl stop -D /opt/local/var/db/postgres/defaultdb' Run client psql -U postgres sudo -u postgres psql Commands Or su -c 'pg_ctl start -D /opt/local/var/db/postgres/defaultdb -l postgreslog' postgres Start and stop server sudo su postgres -c '/opt/local/lib/postgresql/bin/postgres -D /opt/local/var/db/postgres/defaultdb' A handy cheat-sheet for the PostgreSQL database, for when I'm too lazy to dig through the docs or find another cheat-sheet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |