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 XMLTABLE to parse XML data?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I use the PostgreSQL quote_ident function?
- How do I round a number in PostgreSQL?
- How do I use the PostgreSQL NVL function?
- How do I use PostgreSQL with Qt?
- How can I use PostgreSQL XOR to compare two values?
- How do I use the WITH statement in PostgreSQL?
- How can I decide between PostgreSQL and MySQL for my software development project?
See more codes...