Difference between revisions of "PostgreSQL"
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
''' Perintah PostgreSQL ''' | ''' Perintah PostgreSQL ''' | ||
− | Membuat user | + | '''Membuat user''' |
sudo -u postgres createuser --interactive | sudo -u postgres createuser --interactive | ||
− | Membuat database | + | '''Membuat database''' |
sudo -u postgres createdb <namadb> | sudo -u postgres createdb <namadb> | ||
− | + | atau | |
sudo -i -u postgres | sudo -i -u postgres | ||
psql | psql | ||
create database <namadb> | create database <namadb> | ||
− | Cek database | + | '''Cek database''' |
\list | \list | ||
− | Pilih database | + | '''Pilih database''' |
\connect <namadb> | \connect <namadb> |
Revision as of 13:29, 26 November 2020
Install PostgreSQL di Ubuntu 20.04.01
sudo apt update sudo apt install postgresql postgresql-contrib
Cara akses PostgreSQL
Jika kita mempunyai database dengan nama psql
Cara 1
sudo -i -u postgres psql
Cara 2
sudo -u postgres psql
Perintah PostgreSQL
Membuat user
sudo -u postgres createuser --interactive
Membuat database
sudo -u postgres createdb <namadb>
atau
sudo -i -u postgres psql create database <namadb>
Cek database
\list
Pilih database
\connect <namadb>