Situatie
Instalare si utilizare PostgreSQL in Ubuntu
Backup
Solutie
1: Se instaleaza PostgrSQL din terminal cu urmatoarele comenzi :
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib
2.Se configureaza postgre account in baza de date :
$ sudo -i -u postgres
3.Se acceseaza Postgres :
$ psql
4.Pentru iesirea din aplicatie se utilizeaza :
postgres=# q
5.Adaugarea user-ului la Postgres server
postgres@server:~$ createuser –interactive
6.Crearea bazei de date :
postgres@server:~$ createdb sammy sau $ sudo -u postgres createdb sammy
7. Crearea unui tabel;
CREATE TABLE playground (
equip_id serial PRIMARY KEY,
type varchar (50) NOT NULL,
color varchar (25) NOT NULL,
location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
install_date date
);
8.Stergerea tabelului se face cu comanda :
DROP TABLE playground_equip;
Leave A Comment?