Skip to content

Instantly share code, notes, and snippets.

@mridubhatnagar
Last active January 23, 2020 17:29
Show Gist options
  • Save mridubhatnagar/ddffd34f08fe50d8d7f1d6d6da94eeb6 to your computer and use it in GitHub Desktop.
Save mridubhatnagar/ddffd34f08fe50d8d7f1d6d6da94eeb6 to your computer and use it in GitHub Desktop.
Postgresql Setup Lookup Commands
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
ls /etc/postgresql/9.5/main/
service postgresql status
sudo su postgres
psql
default databases - \l
default user - \du
ALTER USER postgres WITH PASSWORD 'Y';
Create new user - CREATE USER X WITH PASSWORD 'Y';
Provide privilages to user -
Make superuser - ALTER USER X with SUPERUSER;
Remove user - DROP USER X;
To see all other commands which can be used - man psql
# pgadmin client for postgresql
SQLAlchemy, alembic, pgadmin were incompatible. To resolve the issue.
pip install alembic==1.3.0
reference link - https://medium.com/@nikhilkrishnan/how-to-install-pgadmin4-in-ubuntu-16-04-with-python3-aecc79de4b7d
NOTE:
1. Running sudo systemctl status pgadmin4 fails.
2. Workaround
3. Activate the virtual environment venv/bin/activate
4. run command python lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
5. Open pgadmin4 in browser http://127.0.0.1:5050/browser/
Reference Link for postgresql installation on ubuntu 16.04 - https://www.youtube.com/watch?v=-LwI4HMR_Eg
Reference for access permission in postgres - https://tableplus.com/blog/2018/04/postgresql-how-to-grant-access-to-users.html
------------Running on personal laptop-------------------
1. cd py3-venv-pgadmin
2. source bin/activate
3. python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment