PostgreSQL

PostgreSQL Basic

January 1, 2020
PostgreSQL, SQL

PostgreSQL Basic # Install # % brew update % brew search postgresql % brew install postgresql@15 % echo 'export PATH="/usr/local/opt/postgresql@15/bin:$PATH"' >> ~/.zshrc % source ~/.zshrc % psql --version psql (PostgreSQL) 15.4 (Homebrew) % brew services start postgresql@15 ==> Successfully started `postgresql@15` (label: homebrew.mxcl.postgresql@15) # **** is default user name % psql -l List of databases Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges -----------+-------+----------+---------+-------+------------+-----------------+------------------- postgres | **** | UTF8 | C | C | | libc | template0 | **** | UTF8 | C | C | | libc | =c/**** + | | | | | | | ****=CTc/**** template1 | **** | UTF8 | C | C | | libc | =c/**** + | | | | | | | ****=CTc/**** (3 rows) # Login to PostgreSQL % psql -h localhost -p 5432 -U your_username -d postgres psql (15. ...