![]() If the server requires password authentication and a password is not available by other means such as a. Note that you must separate name and value if any, by an equal sign on the command line. Perform a variable assignment, like the \set meta-command. (You must have permission to do so, of course.) See \pset for details.Ĭonnect to the database as the user username instead of the default. Specifies options to be placed within the HTML table tag. Turnoff printing of column names and result row count footers, etc. Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Use separator as the record separator for unaligned output. This is equivalent to setting the variable QUIET to on. If this option is used, none of this happens. By default, it prints welcome messages and various informational output. Specifies that psql should do its work quietly. For example, to set the output format to LaTeX, you could write -P format=latex. Note that here you have to separate name and value with an equal sign instead of space. Specifies printing options, in the style of \pset. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432. Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. This can be useful to turn off tab expansion when cutting and pasting. ![]() Write all query output into file filename, in addition to the normal output destination.ĭo not use Readline for line editing and do not use the command history. This is similar to the meta-command \list. Other non-connection options are ignored. ![]() This is equivalent to \pset format html or the \H command. If the value begins with a slash, it is used as the directory for the Unix-domain socket. Specifies the host name of the machine on which the server is running. This is equivalent to \pset fieldsep or \f. Use separator as the field separator for unaligned output. This is in many ways equivalent to the meta-command \i. After the file is processed, psql terminates. Use the file filename as the source of commands instead of reading commands interactively. This is equivalent to setting the variable ECHO to queries. This is equivalent to specifying dbname as the first non-option argument on the command line.Ĭopy all SQL commands sent to the server to standard output as well. Secifies the name of the database to connect to. Start-up files (psqlrc and ~/.psqlrc) are ignored with this option. Specifies that psql is to execute one command string, command, and then exit. This is equivalent to setting the variable ECHO to all. Print all nonempty input lines to standard output as they are read. It enables you to type in queries interactively, sent them to PostgreSQL, and see the query results. Psql is a terminal-based front-end to PostgreSQL. To list all of the tables, views, and sequences in the database, type \z.To list the database's tables and their respective owners, type \dt.To view information about the current database connection, type \conninfo.To view help for SQL commands, type \h.To view help for psql commands, type \?.In windows, current user doesn't matter C:\Program Files\PostgreSQL\9.4\bin>psql -U postgresĪfter accessing a PostgreSQL database, you can run SQL queries and more. Redhat based systems like Centos / Fedora :Ĭonnect/login as root - :~$ su - postgres Typically initdb creates a table named "postgres" owned by user "current logged in user name"Īt the command line in your operating system, type the following command.Ĭonnect/login as root - :~$ sudo -i -u postgres At the time of installing postgres to your operating system, it creates an "initial DB" and starts the postgres server domain running. Running the PostgreSQL interactive terminal program, called psql, which allows you to interactively enter, edit, and execute SQL commands. Connect to PostgreSQL from the command line
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |