Macos 无法在本地运行Postgres(psql)
每当我尝试在本地运行Macos 无法在本地运行Postgres(psql),macos,postgresql,psql,Macos,Postgresql,Psql,每当我尝试在本地运行psql,即$psql-d template1-U postgres时,我会收到-bash:psql:command not found 我已经安装了Postgres Mac应用程序,但当我单击open psql时,我得到 Last login: Tue Jan 6 16:30:17 on ttys001 admins-MacBook-Air:~ surajkapoor$ /Applications/Postgres.app/Contents/MacOS/bin/psql
psql
,即$psql-d template1-U postgres
时,我会收到-bash:psql:command not found
我已经安装了Postgres Mac应用程序,但当我单击open psql时,我得到
Last login: Tue Jan 6 16:30:17 on ttys001
admins-MacBook-Air:~ surajkapoor$ /Applications/Postgres.app/Contents/MacOS/bin/psql ; exit;
psql: FATAL: database "surajkapoor" does not exist
logout
[Process completed]
这对我来说毫无意义。我假设在本地安装mac应用程序安装postgres 您需要将psql文件所在的目录添加到mac的PATH变量中,该变量将是
/Applications/Postgres.app/Contents/MacOS/bin/
在不带参数的情况下打开psql将尝试连接到具有当前用户名称的数据库,如果您不想将目录添加到PATH变量,您可以将整个地址放在控制台上,这样应该可以工作
/Applications/Postgres.app/Contents/MacOS/bin/psql -d template1 -U postgres
为什么在使用
psql
时指定所需的参数,而在使用工具的完整路径时不指定?