简体   繁体   中英

Having issues with command line and Postgres 12 psql

I am a complete novice. I am following the freecodeacademy tutorial on Postgres and set up the environment fine with the bin and lib.

My issue comes with his next instructions which insinuate I can just put 'psql' and then it will open my environment to postgres. This is not the case for me. It actually prompts me to enter my password for my User profile as in my laptop userprofile and when I do, the password is marked as incorrect. for example, it's not showing C:\Program Files\PostgreSQL\12\bin> like I pathed it in the environment settings. Just my regular user profile.

The only way I have been able to enter the environment is using 'psql -U postgres' and then entering the password I set for it.

psql --help also doesn't work.

I was hoping anyone had any advice for me as a newbie (alternative resource/solution-wise)? I don't have cmd line or any coding experience so my troubleshooting with this is not good because it's very foreign to me.

Thanks for any help

You probably want to connect to the postgres database as user postgres :

psql -U postgres -d postgres

You can set the environment variables PGUSER and PGDATABASE to the user and database you want by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM