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 postgresand 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 restartto apply the changes.
Example code block:
CREATE DATABASE mydb;
No output.
More of Postgresql
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I use PostgreSQL on the Yandex Cloud platform?
- How do I use the PostgreSQL NVL function?
- How can I set a PostgreSQL interval to zero?
See more codes...