Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a psql client config file analogous to $HOME/my.cnf for mysql ? [closed]

That is, a local file on the client machine with default "host", "port", "user" values, etc., so that I don't have to enter them on the command line each time?

like image 389
Jerry Avatar asked May 07 '13 15:05

Jerry


People also ask

Where is PostgreSQL config file?

PostgreSQL configuration files are stored in the /etc/postgresql/<version>/main directory. For example, if you install PostgreSQL 12, the configuration files are stored in the /etc/postgresql/12/main directory.

Can I have mysql and PostgreSQL on the same server?

No, there is no technical problem. Both default to different ports they listen on. The only problem that could arise is that each individual DB might be slower compared to an installation on separate phyiscal machines because they are both share (and fight for) for the same resources (I/O, memory, CPU, network, ...)

Where is my CNF file in mysql?

cnf is located in /etc/mysql/my. cnf .

What is PostgreSQL conf file in PostgreSQL?

conf is PostgreSQL's main configuration file and the primary source of configuration parameter settings. postgresql. conf is a plain text file generated by initdb and is normally stored in the data directory. However some distributions' packages may place postgresql.


2 Answers

Use the password file with lines like:

hostname:port:database:username:password

If you always log into the same host:db:port:user then this will make it:

*:*:*:*:mypassword
like image 172
Clodoaldo Neto Avatar answered Sep 23 '22 04:09

Clodoaldo Neto


You can either define one (or several ) alias to psql with the proper arguments for user, database, host. Or set some environment values.

like image 29
leonbloy Avatar answered Sep 22 '22 04:09

leonbloy