This method lists all databases and pipes the output to grep to find your specific database name.
psql -l | grep -qw your_db_name && echo "Database 'your_db_name' exists." || echo "Database 'your_db_name' does not exist."in dev mode: ```bash psql -U postgres -l | grep -qw task_api_db && echo "Database 'task_api_db' exists." || echo "Database 'task_api_db' does not exist."
#### Method 2: Using pg_isready (For connection status)
This utility checks if the server is accepting connections for a specific database.
```bash
pg_isready -d your_db_name -q && echo "Server ready for 'your_db_name'." || echo "Server not ready or DB not found."
in dev mode:
pg_isready -d task_api_db -q && echo "Server ready for 'task_api_db'." || echo "Server not ready or DB not found."# connect to postgreSql command line tool
sudo -i -u postgres
# create a new user in db
createuser --interactive --pwprompt <username>ALTER USER <username> PASSWORD 'mynewpassword@#$@#sfsSDF';sudo find / -name pg_hba.conf
cat /opt/homebrew/var/postgresql@14/pg_hba.conf
sudo cat /Library/PostgreSQL/18/data/pg_hba.conf
#### postgresql remove macos
open /Library/PostgreSQL/<version>/uninstall-postgresql.app
open /Library/PostgreSQL/18/uninstall-postgresql.app
sudo /Library/PostgreSQL/<version>/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
sudo /Library/PostgreSQL/18/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh