Data export and import
1# install postgresql in macos
2brew install postgresql@15
3# settings to the path variable
4echo 'export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"' >> ~/.zshrc
5
6# dump database to sql file
7pg_dump --host xxxxx.eu-west-1.compute.amazonaws.com --port 5432 --user username database > backup.sql
8
9# change username password
10ALTER USER user_name WITH PASSWORD 'new_password';
11# import the data to postgresql
12psql --host x.x.x.x --user dba --db postgres < dump-xxx-xxxx.sql
Reference