Thank you [Was: Switching from 9.1 to 9.5 on Ubuntu 16.04]
Mike Dewhirst <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.novice |
|---|---|
| Message-ID | <[email protected]> |
Pavan and Fabio I always felt Postgres was a good choice for me and your support in this list has really confirmed it. Thank you very much Cheers Mike On 22/08/2018 7:33 PM, pavan95 wrote: > Mike, > >>> 2) If yes then stop 9.1 server and make sure only postgres 9.5 is in > active state(you can do this as "su postgres" user) > >> Not sure what you mean? Not sure how to stop one server without stopping > another. Typically I use sudo service postgres stop/start/restart and that > seems to work on all together. > > See, in /etc/init.d/ folder postgres is created as service so action on that > service will be equivalently effected for all the postgres instances on this > server. For example you do have postgres 9.1,9.3,9.5 on the same ubuntu > server and if you issue: > service postgresql start/stop/restart > it will actually affect all the 3 instances. So you need to be specific and > issue command(as previously said) like : > /usr/lib/postgresql/9.5/bin/pg_ctl -D "/var/lib/postgresql/9.5/main" start > /usr/lib/postgresql/9.5/bin/pg_ctl -D "/var/lib/postgresql/9.5/main" stop > etc... > > Note: for issuing above commands you should be postgres user(from OS level > and DB level) > >>>> createdb --port=5432 --host=pq4 --template=template0 --encoding=UTF8 > --lc-collate=C --lc-ctype=C --username=miked --owner=miked train > >>> 3) Ensure the active listening postgres ports on the server by: >>> netstat -alp | grep "5432" >>> >> mike@pq4:~$ netstat -alp | grep "543" >> (Not all processes could be identified, non-owned process info >> will not be shown, you would have to be root to see it all.) >> tcp 0 0 localhost:5431 *:* LISTEN > - >> tcp 0 0 pq4:5431 *:* > LISTEN - >> tcp 0 0 localhost:5433 *:* LISTEN > - >> unix 2 [ ACC ] STREAM LISTENING 31377 - > /var/run/postgresql/.s.PGSQL.5432 >> unix 2 [ ACC ] STREAM LISTENING 31378 - > /var/run/postgresql/.s.PGSQL.5433 >> unix 2 [ ACC ] STREAM LISTENING 31438 - > /var/run/postgresql/.s.PGSQL.5431 >> mike@pq4:~$ > >From the above output you are trying to create a database on database port > 5432 which is not active. Postgres is unable to understand how to create a > database on a closed port(which is not going to work for sure). Ensure > yourself that the port on which you are creating database is in open state > and accepting client requests. > >>> 4) Later as same "su postgres user" >>> >> mike@pq4:~$ su postgres >> Password: >> su: Authentication failure >> mike@pq4:~$ su postgres user >> Password: >> su: Authentication failure >> mike@pq4:~$ sudo -u postgres psql >> could not change directory to "/home/mike": Permission denied >> psql (9.5.14) >> Type "help" for help. >> >> postgres=# \password postgres >> Enter new password: >> Enter it again: >> postgres=# \q >> mike@pq4:~$ su postgres >> Password: >> su: Authentication failure >> mike@pq4:~$ >> >> As you can see I don't know how to change the postgres user password. Did > it a few times just to be sure. > > Firstly, do you have root access for that server? > > If yes, you can issue sudo bash as the user(you will login to the server) > and then you can change the password for the OS level postgres user like > below: > > [root@pg4]# passwd postgres > Changing password for user postgres. > New password: > Confirm New password: > > then password will be changed for that user and can try logging in as : > [root@pg4]# su postgres > [postgres@pg4]# > > Now issue the above said commands > > /usr/lib/postgresql/9.5/bin/pg_ctl -D "/var/lib/postgresql/9.5/main" start > /usr/lib/postgresql/9.5/bin/pg_ctl -D "/var/lib/postgresql/9.5/main" stop > etc.. > > > Which will work for sure... > >> What I would like to do is uninstall 9.1 and 9.3. How would I do that? > issue the below command: > *dpkg -l | grep postgresql * > > Consider removing the postgres versions you like to remove!! Anyways this is > not a proper fix for your prob. > > Jus ensure the port is listening on your server to execute your createdb > command. Acknowledge for further queries if any. > > Regards, > Pavan, > 9841380956 > > > > > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-novice-f2132464.html > >