Postgres issue
May 18, 2021
Today, I ran into a postgres connect issue when I was going back to a database under development on my localhost because I needed to add another feature. This was the error that I received in my terminal when I tried to 'npm run start':
I never ran into this problem before so I am thinking maybe something needed updating because even my Postico was not opening my databases. I googled this error and found that someone with a Mac had this problem and fixed it by typing the following command in the terminal:
Then, my terminal prompted me with the following:
And then typed in:
After that I figured I had to enter
Note: I put ****** in place of part of my username for privacy above.
psql: error: could not connect to server: could not connect to server:
I never ran into this problem before so I am thinking maybe something needed updating because even my Postico was not opening my databases. I googled this error and found that someone with a Mac had this problem and fixed it by typing the following command in the terminal:
brew install postgres
Then, my terminal prompted me with the following:
To have launchd start postgresql now and restart at login:
brew services start postgresql
so, I copied and pasted brew services start postgresql
And then typed in:
psql
in my terminal and it was giving me this error: psql: error: could not connect to server: FATAL: database "******injaspace" does not exist. After that I figured I had to enter
createdb
in the terminal and it looks like my old databases were wipe out. So in order to get my existing database to work again like it did a couple of weeks ago, I had to create the database again so I entered:CREATE DATABASE roses;
because roses was what I called my database. So I went back to my project in Visual Studio Code, started the server and voila, the error went away. I seeded my data and it is back now. This took me a good 45 minutes to debug. Hope it'll help you.Note: I put ****** in place of part of my username for privacy above.
Posted by Ninja Space Content. Posted In : postgres