I tried to start my postgresql database after reinstalling WSL, I started the server successfully
nnaemekaxjohn@Nnaemeka:/mnt/c/Users/HP/documents/the_age_project/postgresql-11.17$ bin/pg_ctl -D demo -l logfile start
waiting for server to start....... done
server started
nnaemekaxjohn@Nnaemeka:/mnt/c/Users/HP/documents/the_age_project/postgresql-11.17$ bin/psql --port=5430 demo
psql: FATAL: role "nnaemekaxjohn" does not exist
But when I try to connect to my demo
database I get the Fatal error, I suspect this is as a result of changing my ubuntu username during WSL reinstallation.
How can this error be fixed?
2
Answers
run this command first
then reset the cluster using this coommand
You can create a new user with necessary privileges granted.
First check for the existing users:
If your username is not listed then create a new user:
Next, grant privileges to the user:
Note: Consider to set name same as your ubuntu username.