1 |
On Saturday 13 Feb 2016 12:27:54 Michael Orlitzky wrote: |
2 |
> On 02/13/2016 12:16 PM, Mick wrote: |
3 |
> > Thank you both, I used pg_dumpall, but when I tried to restore it with |
4 |
> > |
5 |
> > psql -f postgress_20160213 postgres |
6 |
> > |
7 |
> > it complained that user 'michael' doesn't exist. Then tried logged in as |
8 |
> > root, whereby it complained that user 'root' doesn't exist. Then I 'su - |
9 |
> > postgres' and it restored the database. Is this how I am supposed to |
10 |
> > restore from a backup? |
11 |
> > |
12 |
> > I only run postgres for KDEPIM's akonadi, which seems to work fine post- |
13 |
> > upgrade. :-) |
14 |
> |
15 |
> That works sort of by accident. If you don't specify a username on the |
16 |
> command-line, psql will try to log you in to postgresql using your |
17 |
> system username -- "michael", for you. When you ran psql as root, it |
18 |
> tried to log you into postgresql as the "root" postgresql user, and he |
19 |
> doesn't exist. |
20 |
> |
21 |
> The default admin user built-in to postgresql is called "postgres", so |
22 |
> if you just happen to run psql as the system "postgres" user, it will |
23 |
> try to log you in as "postgres" and it will work. |
24 |
> |
25 |
> If you run "psql -U postgres" it should achieve the same thing. And if |
26 |
> you don't want to have to remember that, you can create a ~/.pgpass file |
27 |
> that says to always use the "postgres" database user: |
28 |
> |
29 |
> http://www.postgresql.org/docs/current/static/libpq-pgpass.html |
30 |
|
31 |
Thank you Michael. It was pretty painless TBH, almost as easy as upgrading |
32 |
mysql. ;-) Your page also nicely details the alternative, which I did not |
33 |
try out. |
34 |
-- |
35 |
Regards, |
36 |
Mick |