Postgres

De Linuxmemo.

(Différences entre les versions)
(Démarrage rapide de Postgres)
(Démarrage rapide de Postgres)
Ligne 22 : Ligne 22 :
  createuser root
  createuser root
  psql -c "ALTER USER nom_user WITH PASSWORD 'password';"
  psql -c "ALTER USER nom_user WITH PASSWORD 'password';"
 +
psql -c "DROP USER jonathan;"
=== Commandes du client "psql" ===
=== Commandes du client "psql" ===

Version du 31 août 2012 à 20:11


Bases de données:

Démarrage rapide de Postgres

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
sous bash
su - postgres
createuser root
psql -c "ALTER USER nom_user WITH PASSWORD 'password';"
psql -c "DROP USER jonathan;"

Commandes du client "psql"

\l = liste des bases
\c nombase = connexion a la base nombase
\d = liste des tables
\q = quitter
\h = aide
SELECT version(); = version PostgreSQL
SELECT current_date; = date actuelle
\i fichier.sql = lit les instructions du fichier fichier.sql
\d table = décrit une table (comme DESCRIBE avec MySQL)

http://blog.endpoint.com/2009/12/mysql-and-postgres-command-equivalents.html

Outils personnels