How to import database to PostgreSQL as root? -


i want import database of mine database of server. so, copied database dump file server's root directory , logged in , did this:

root@iwidgetserver1:~# sudo -u postgres psql -u iwidget -d iwidget -f iwidget_dump2.sql  not change directory "/root" psql: fatal:  peer authentication failed user "iwidget" 

however, iwidget role , has granted priviliges database:

root@iwidgetserver1:~# sudo -u postgres psql -l not change directory "/root"                                      list of databases        name       |  owner   | encoding |   collate   |    ctype    |   access privileges    ------------------+----------+----------+-------------+-------------+-----------------------  iwidget          | iwidget  | utf8     | en_gb.utf-8 | en_gb.utf-8 | =tc/iwidget          +                   |          |          |             |             | iwidget=ctc/iwidget  postgres         | postgres | utf8     | en_gb.utf-8 | en_gb.utf-8 |   sample_db        | postgres | utf8     | en_gb.utf-8 | en_gb.utf-8 |   template0        | postgres | utf8     | en_gb.utf-8 | en_gb.utf-8 | =c/postgres          +                   |          |          |             |             | postgres=ctc/postgres  template1        | postgres | utf8     | en_gb.utf-8 | en_gb.utf-8 | =c/postgres          +                   |          |          |             |             | postgres=ctc/postgres  template_postgis | postgres | utf8     | en_gb.utf-8 | en_gb.utf-8 |  (6 rows) 

what doing wrong?

from docs:

the peer authentication method works obtaining client's operating system user name kernel , using allowed database user name (with optional user name mapping). method supported on local connections.

you're doing sudo -u postgres, trying connect iwidget.

you need create user named iwidget , login user.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -