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 troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I use PostgreSQL with YAML?
- How can Zalando use PostgreSQL to improve its software development?
- How can I set a PostgreSQL interval to zero?
- How do I parse XML data using PostgreSQL?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I integrate PostgreSQL with Yii2?
See more codes...