Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems starting Postgresql with sudo

Running Ubuntu 17.10 and I am having an issue running Postgres. It was working a couple weeks ago, but now I have this problem.

sudo su postgres psql

/usr/bin/psql: line 19: use: command not found
/usr/bin/psql: line 20: use: command not found
/usr/bin/psql: line 21: use: command not found
/usr/bin/psql: line 22: use: command not found
/usr/bin/psql: psql: line 24: syntax error near unexpected token `$version,'
/usr/bin/psql: psql: line 24: `my ($version, $cluster);'

I have no idea what to do, the syntax looks normal.

like image 991
Oh Great One Avatar asked Sep 04 '26 07:09

Oh Great One


1 Answers

Try

sudo -u postgres psql

instead.

I actually do not know what your command does. A quick look to man su does not really clarify what su will do with extra arguments but obviously it is not starting psql, it is probably feeding the file contents to the shell.

like image 187
markus987 Avatar answered Sep 07 '26 03:09

markus987



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!