Thread: About "ALTER USER" command
Good day for You. I need to change password of the usuary POSTGRES using the commando "ALTER USER". This change I must do it by means of a program .bat in quiet way. I have the following instruction in .bat program : psql -S "ALTER USER postgres WITH PASSWORD 'xxtyod';" But when I execute this program, it requests user password to me. It is possible that some commando exists who is due to place before so that he does not request ANY password. then, it would be thankful indicated to me what commands is used so that it does not request any type of password nor of user. Solely that executes the instruction that I mentioned to them previously. Again, thanks for its valuable collaboration. Sincerely , | |||
Attachment
Mónica Ivonne Herrera Alonso wrote: Mónica, > I need to change password of the usuary POSTGRES using the commando "ALTER > USER". This change I must do it by means of a program .bat in quiet way. > > I have the following instruction in .bat program : > > psql -S "ALTER USER postgres WITH PASSWORD 'xxtyod';" > > But when I execute this program, it requests user password to me. Sure. It's asking for the password of the user who will connect to the database and issue the SQL command. There are several ways to avoid this; the simplest is to create an appropiate .pgpass file (pgpass.conf in Windows). The exact location is something like %APPDATA%/postgresql, but better look it up in the documentation. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" "Having your biases confirmed independently is how scientific progress is made, and hence made our great society what it is today" (Mary Gardiner)
Mónica Ivonne Herrera Alonso wrote: Hi, > However. I continued my instruction and follows without working to me. > Exists the way to invoke psql that is not of interactive way so that It > alters password of a user with no need to be in psql? > > With the commando psql - S ALTER USER it continues saying to me that that > data base does not exist, still modified the file pgpass.conf. If you know > some way in that this can be done, would be thankful to you immensely. Well, if the message is that the database doesn't exist, you certainly can't fix that by putting anything in pgpass.conf. I guess you should be trying to connect to a database that does exist. May I suggest you join the pgsql-es-ayuda list -- maybe you'll find it easier to pose your questions in spanish instead. (They are quite offtopic for pgsql-hackers anyway.) If you do, make sure you repost your question with additional details, like a cut'n pasted extract of psql going wrong, with the exact error message. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Alvaro: In effect I published the file pgpass.conf and I added the following line: localhost:5432:*:postgres:kklliu However. I continued my instruction and follows without working to me. Exists the way to invoke psql that is not of interactive way so that It alters password of a user with no need to be in psql? With the commando psql - S ALTER USER
it continues saying to me that that data base does not exist, still modified the file pgpass.conf. If you know some way in that this can be done, would be thankful to you immensely. Sincerelly, -------Mensaje original------- Mónica Ivonne Herrera Alonso wrote: Mónica, > I need to change password of the usuary POSTGRES using the commando "ALTER > USER". This change I must do it by means of a program .bat in quiet way. > > I have the following instruction in .bat program : > > psql -S "ALTER USER postgres WITH PASSWORD 'xxtyod';" > > But when I execute this program, it requests user password to me. Sure. It's asking for the password of the user who will connect to the database and issue the SQL command. There are several ways to avoid this; the simplest is to create an appropiate .pgpass file (pgpass.conf in Windows). The exact location is something like %APPDATA%/postgresql, but better look it up in the documentation. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" "Having your biases confirmed independently is how scientific progress is made, and hence made our great society what it is today" (Mary Gardiner) | |||
Alvaro: In effect I published the file pgpass.conf and I added the following line: localhost:5432:*:postgres:kklliu However. I continued my instruction and follows without working to me. Exists the way to invoke psql that is not of interactive way so that It alters password of a user with no need to be in psql? With the commando psql - S ALTER USER
it continues saying to me that that data base does not exist, still modified the file pgpass.conf. If you know some way in that this can be done, would be thankful to you immensely. Sincerelly, -------Mensaje original------- Mónica Ivonne Herrera Alonso wrote: Mónica, > I need to change password of the usuary POSTGRES using the commando "ALTER > USER". This change I must do it by means of a program .bat in quiet way. > > I have the following instruction in .bat program : > > psql -S "ALTER USER postgres WITH PASSWORD 'xxtyod';" > > But when I execute this program, it requests user password to me. Sure. It's asking for the password of the user who will connect to the database and issue the SQL command. There are several ways to avoid this; the simplest is to create an appropiate .pgpass file (pgpass.conf in Windows). The exact location is something like %APPDATA%/postgresql, but better look it up in the documentation. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" "Having your biases confirmed independently is how scientific progress is made, and hence made our great society what it is today" (Mary Gardiner) | |||