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 use PostgreSQL and ZFS snapshots together?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I install PostgreSQL and Zabbix on my system?
- How can I use PostgreSQL with Zabbix?
- How can I extract the year from a PostgreSQL timestamp?
- How do I use the PostgreSQL XML type?
- How can I convert XML data to a PostgreSQL table?
- How do I use a PostgreSQL XML parser in an example?
- How can I use PostgreSQL XOR to compare two values?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
See more codes...