Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (10.6)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for
假设我有下面的表、函数和数据 create table people (
id bigserial primary key,
age int,
height int,
weight int
);
create or replace function add_person (p_age int, p_height int, p_weight int);
create or replace function get_person_by_age (p_age int);
create or replace f
我有一个Python脚本,它遍历一个文件夹,为每个文件创建一个shell命令。
每个命令都写到一个shell脚本中,然后使用subprocess.Popen运行这个脚本。(我需要这样做,因为我还需要在命令运行之前设置环境)。
以下是一些伪代码:
def create_shell_script(self):
'''loop through a folder, create a command for each file and write this to a shell script'''
# command to run
我得到了著名的
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
在OSX的终端中尝试createdb时出错,所以按照说明,我将export PATH=/opt/local/lib/postgresql92/bin:$PATH添加到我的.bash_profile中,现在
如何使用Ant构建脚本检查root权限?我尝试使用shellscript任务来完成此任务,如下所示
<shellscript shell="bash">
if [[ `whoami` != 'root' ]]; then
echo "You need to be root to install ooplss";
exit 1
fi
</shellscript>
但这不会停止脚本的执行。
还有其他想法吗?
我在./ShellScript.sh的UbuntuServer14.04LTS中有一个shell脚本。我设置了/etc/rc.local,以便在启动后运行shell脚本,但在登录之前使用下面的代码。
要运行它,请在终端:sudo nano /etc/rc.local中写入以下命令,然后添加以下命令并保存。
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on
我使用的是。在菜单栏中,它给出错误“无法在端口5432上启动”。类似地,如果我尝试从终端启动服务器,我会得到:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
我还运行了pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/s
我的psql打不开。奇怪的是。我使用psql -U postgres通过日志创建了一个用户"Ben“,它允许我打开PSQL并运行一个命令。
CREATE USER Ben WITH PASSWORD '123';
在我这样做之后,它会显示ERROR: role "ben" already exists
但是当我运行psql时,它抛出了psql: FATAL: role "Ben" does not exist
我最近安装了Ubuntu的最新版本,我还不习惯它。我在连接PostgreSQL和pgadmin3时遇到了几个问题。
我试着按照几个教程创建一个可以在pgadmin3中使用的本地主机服务器。我并没有真正达到目标,我认为我通过安装、卸载、安装、卸载、尝试找到答案使事情变得更糟。在这一点上,我不确定我的PostgreSQL是否干净。我可能已经安装了两个PostgreSQL,但我还是不确定。我试图卸载它,但我有一个错误,基本上说PostgreSQL不在sudo中。
问题是,我现在在控制台中运行psql时出错了:
$psql
psql: FATAL: role "user" does n
当运行下面的命令时,我得到一个语法错误。
yyyyyydb=# psql yyyyyydb< /tmp/yyyyyydb_bkp_11202017.sql;
ERROR: syntax error at or near "psql"
LINE 1: psql waivrdb < /tmp/yyyyyydb_bkp_11202017.sql;
我有一个PostgreSQL查询,如下所示,它运行良好。我从shell脚本调用它,如下所示
Result=$(psql -U username -d database -t -c
$'SELECT round(sum(i.total), 2) AS "ROUND(sum(i.total), 2)"
FROM invoice i
WHERE i.create_datetime = '2019-03-01 00:00:00-06'
AND i.is_review = '1' AND i.user_id != 60;'
我安装了Postgres.app,当我打开它时,菜单栏图标显示"Running on Port5432“。但当我单击"Open psql“菜单选项时,我看到以下消息:
/Applications/Postgres.app/Contents/MacOS/bin/psql ; exit;
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/