postgresqlHow do I install and configure PostgreSQL on a Windows machine?
- Download and install the latest version of PostgreSQL from the official website.
- Create a database cluster by running the command
initdb -D "C:\Program Files\PostgreSQL\12\data"
in the terminal. - Start the PostgreSQL server by running the command
pg_ctl -D "C:\Program Files\PostgreSQL\12\data" -l logfile start
. - Connect to the server using the command
psql -h localhost -U postgres
and create a new database with the commandCREATE DATABASE mydb;
. - Configure the authentication settings in the pg_hba.conf file located in the data directory.
- Set up the database connection by editing the postgresql.conf file located in the data directory.
- Restart the server by running the command
pg_ctl -D "C:\Program Files\PostgreSQL\12\data" -l logfile restart
to apply the changes.
Example code block:
CREATE DATABASE mydb;
No output.
More of Postgresql
- How can I set a PostgreSQL interval to zero?
- How can Zalando use PostgreSQL to improve its software development?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL and ZFS snapshots together?
- How can I use PostgreSQL XML functions to manipulate XML data?
- How do I use the PostgreSQL to_char function?
- How do I list tables in PostgreSQL?
- How can I use PostgreSQL's "zero if null" feature?
See more codes...