You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your command-line run the command: brew install postgresql
Run the command: ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Create two new aliases to start and stop your postgres server. They could look something like this:
alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
Run the alias you just created: pg_start. Use this comment to start your database service.
alternatively, pg_stop stops your database service.
Run the command: createdb `whoami`
Connect to your postgres with the command: psql
brew reinstall readline - if needed
createuser -s postgres - fixes role "postgres" does not exist
Test with psql command
$ psql
psql (10.0)
Type "help" for help.
ibraheem=#
Details
What is this ln command I ran in my Terminal?
from the man ln command
The ln utility creates a new directory entry (linked file) which has the same modes as the original file. It is useful for maintaining multiple copies of a
file in many places at once without using up storage for the copies''; instead, a link points'' to the original copy. There are two types of links; hard
links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and symbolic link.
What is launchctl?
from the man launchctl command
launchctl interfaces with launchd to manage and inspect daemons, angents and XPC services.
dropdb <database_name>
drop database <database_name>
dropdb mydjangoproject_development
if, database is accessed by other users, then
REVOKE CONNECT ON DATABASE TARGET_DB FROM public;
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB';