如何使用 DataGrip 在本地创建 postgre SQL 数据库

Elg*_*ath 2 sql database postgresql datagrip

我正在开始使用 Data Grip,但在开始做任何事情之前我就陷入了困境。我做的第一件事是使用默认参数创建 postgre 数据源。

特性

现在我打开一个控制台,并尝试运行一个脚本:

drop table table1;
Run Code Online (Sandbox Code Playgroud)

然后控制台打印:

Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Run Code Online (Sandbox Code Playgroud)

特性

我该怎么办,以便我可以在例如:D:\Database\ 中创建我的项目,而不是连接到其他主机?

Chr*_*son 5

听起来你实际上并没有在本地运行 PostgreSQL。是否已安装并运行?PostgreSQL 是一个基于客户端/服务器的数据库系统,因此它需要运行服务器进程。这与在应用程序中独立运行的 SQLite 或 HSQLDB(或本例中的 DataGrip)不同。请参阅此处有关如何在 Mac 上开始使用 Postgres 的教程。其他操作系统也有类似的教程。