由普通用户安装 PostgreSQL 10。
启用并启动其服务:
sudo systemctl start postgresql-10
sudo systemctl enable postgresql-10
Run Code Online (Sandbox Code Playgroud)
然后使用用户登录postgres:
sudo su - postgres
Run Code Online (Sandbox Code Playgroud)
将此设置添加到.bash_profile文件中:
export PATH=$PATH:/usr/pgsql-10/bin/
Run Code Online (Sandbox Code Playgroud)
通过以下方式重新启动 PostgreSQL pg_ctl:
-bash-4.2$ pg_ctl restart
Run Code Online (Sandbox Code Playgroud)
然后退出到普通用户,再次检查postgresql的状态,失败。即使用这种方式重启也不能成功:
sudo systemctl restart postgresql-10
sudo systemctl stop postgresql-10
Run Code Online (Sandbox Code Playgroud)
总是如此failed。
但如果我使用postgres用户来测试重新启动、停止、启动,它们都可以成功。
这两种方式控制的不是同一个过程?
添加postgresql-10服务内容
$ sudo systemctl cat postgresql-10.service
# /usr/lib/systemd/system/postgresql-10.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# …Run Code Online (Sandbox Code Playgroud) 例如从 更改C为utf8?
我尝试过这个,但似乎不允许。
postgres=# ALTER DATABASE mydb SET "Collate" To 'en_US.UTF-8';
ERROR: unrecognized configuration parameter "Collate"
Run Code Online (Sandbox Code Playgroud) postgresql ×2