26 Apr 2024
Access the database through CLI with sudo -u postgres psql. \q to get out again. Default port is 5432.create database mydb;
create user myuser with encrypted password 'mypass';
grant all privileges on database mydb to myuser;
drop database mydb;
drop user myuser;
It is doesn't accept the above, try restarting the service (sudo service postgresql restart).
pg_dump --dbname=postgresql://myuser:mypass@192.168.1.10:5432/mydb > mydb.sql
Replace myuser with your username, mypass with your password, 192.168.1.10 with your servers IP address and mydb with your database. The > mydb.sql at the end simply dumps the output into a file named mydb.sql. Change it to suit your needs.
SELECT pg_catalog.setval('public.posts_id_seq', 23, true);
Your sequence will probably have a naming convention similar to TABLENAME_id_seq. My table from the example above is named posts.
How to easily web scrape any website with Python
Published 2024-05-03
Datahoarding
Notes
Python
Web development
Learn how to easily web scrape any website using Python. I go through the various techniques I use.
Read the post →RockyLinux notes
Published 2024-05-05
DevOps
Linux
Notes
Various notes gathered after converting to RockyLinux from CentOS.
Read the post →Python notes
Published 2024-05-03 — Updated 2024-05-14
Notes
Python
Different tips, tricks and how-to's while developing various scripts in Python.
Read the post →