postgres --version
brew install postgres
brew services start postgresql
pg_ctl -D /usr/local/var/postgres start
brew search postgresql
brew install postgresql@#
pg_ctl
command and you get an error about the user database not installed
createdb 'whoami'
: with tick marks, not single quotes!psql
psql
utility function that lets you perform admin functionsbrew doctor
brew update
brew uninstall postgres
rm -rf rm -rf /usr/local/var/postgres
rm -rf .psql_history .psqlrc .psql.local .pgpass .psqlrc.local
brew list
to confirm postgres is actually deletedbrew update
brew install postgres
brew install postgresql
BEFORE BUNDLING IF YOU HAVEN'T INSTALLED
POSTGRESQL YET!!rails new app_name -T -d postgresql
psql postgres
\du
/usr/local/opt/postgres/bin/createuser -s postgres
psql -U postgres
\password postgres
psql -U postgres
OR psql postgres
psql postgres -U nameofuser
CREATE DATABASE name;
don't forget the semicolon!!!*CREATE ROLE nameofuser WITH PASSWORD '';
GRANT ALL PRIVILEGES ON DATABASE nameofDB TO nameofuser;
ALTER ROLE name CREATEDB;
\q
quits\list
or \l
lists all databases\dt
lists all tables in the database\du
lists all users\dx
lists all extensions used in the db