?
Solved

How to check the database name of postgres in my linux machine

Posted on 2008-06-17
9
Medium Priority
?
2,550 Views
Last Modified: 2013-12-16
How to check the database name of postgres in my linux machine

i need to take the backup for that i have to give dabase name
i only know username and password ...

this is the command :
pg_dump -Ft -b mydb > db.tar

one more doubt is ..

which one i need to use db.tar
or
db.tz

or
db.out

0
Comment
Question by:jaisonshereen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 9

Accepted Solution

by:
sanjooz earned 2000 total points
ID: 21808103
Depends on what you want.

If you want the output to be a tar file then use
pg_dump -Ft -b mydb > db.tar

If you want the ordinary output use .out file

http://www.postgresql.org/docs/7.4/static/app-pgdump.html
0
 

Author Comment

by:jaisonshereen
ID: 21808190
Ok thanks !

how to find out my db name? ... i have already installed database in my server..how to find the dbname?
0
 
LVL 9

Expert Comment

by:sanjooz
ID: 21808279
Well the database name is the one you created. If you do not know all the databases in postgres, login locally to postgres by issuing command psql on command line.

then at the postgres prompt do a \l (that is a backward slash and el). It will show you a list of databases.
0
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 

Author Comment

by:jaisonshereen
ID: 21808505
what is the command to login to postgres without using database name?
0
 
LVL 9

Expert Comment

by:sanjooz
ID: 21808738
login locally to postgres by issuing command <B> psql </B>on command line.

psql
0
 

Author Comment

by:jaisonshereen
ID: 21808749
its taking root as database and giving error :

 psql
psql: FATAL:  database "root" does not exist

Open in new window

0
 
LVL 9

Expert Comment

by:sanjooz
ID: 21809143
That is because you are logged in to console as root. Log in as a normal user and then use psql command
0
 

Author Comment

by:jaisonshereen
ID: 21810716
i didnt have any other  user credentials
0
 
LVL 9

Expert Comment

by:sanjooz
ID: 21812070
When you installed postgres, you must have created postgres user. Look in your /etc/passwd, or you could run this command

cat /etc/passwd | cut -d":" -f1

then login as as postgres user : su postgres
and then :  psql
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question