![]() Ii) Now restart the postgres by using any of these commands :- sudo /etc/init. Or for older versions it'll be :- local all postgres ident Just below that line there must be a commented line that says: local all postgres peer I) Now go to sudo vim /etc/postgresql//main/pg_hba.conf file and look for line that says : local all postgres md5 #peerĪnd comment that. The change will take effect the next time the user logs in. :-)Īnswer given is almost correct just missing some pointers which i'll be taking care of in my solutionįirst make sure your user have a sudo access if not you can use the below command to add your user as sudo user :- sudo adduser sudo ![]() Now you should be able to give pgAdmin a valid password for the DB superuser and it will be happy too. You can leave the psql shell by typing Ctrl D or with the command \q. Inside the psql shell you can give the DB user postgres a password: ALTER USER postgres PASSWORD 'newPassword' If any of those commands fail with an error psql: FATAL: password authentication failed for user "postgres" then check the file /etc/postgresql/8.4/main/pg_hba.conf: There must be a line like this as the first non-comment line: local all postgres identįor newer versions of PostgreSQL ident actually might be peer. If that fails with a database "postgres" does not exists error, then you are most likely not on a Ubuntu or Debian server :-) In this case simply add template1 to the command: sudo -u postgres psql template1 The next thing in line is to create a database. That said the PHP part is fairly trivial to swap out with something like ASP.NET and most other web server side languages. Most of the work is happening in the JQuery client side tier and the database part we already saw. That means, that you can login to that account only by using the postgres OS user account.Īssuming, that you have root access on the box you can do: sudo -u postgres psql You can connect to the postgres database with the moviefan user now: psql -d postgres -U moviefan The terminal now shows postgres>, which is an indicator of not being logged in as a superuser anymore. This example requires PHP 5.1 since it uses the pgqueryparam function introduced in PHP 5.1. If I remember correctly the user postgres has no DB password set on Ubuntu by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |