Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 如何在mac os x 10.8.2上重置postgresql 9.2默认用户(通常为';postgres';)密码?_Macos_Postgresql - Fatal编程技术网

Macos 如何在mac os x 10.8.2上重置postgresql 9.2默认用户(通常为';postgres';)密码?

Macos 如何在mac os x 10.8.2上重置postgresql 9.2默认用户(通常为';postgres';)密码?,macos,postgresql,Macos,Postgresql,我刚刚将PostgreSQL 9.2从安装到Mac OS X 10.8.2上。我输入了我的postgres用户密码,因此无法连接。如何重置密码?: 修改/Library/PostgreSQL/9.2/data/pg_hba.conf -local all all md5 +local all all trust 重新启动postgres /Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/

我刚刚将PostgreSQL 9.2从安装到Mac OS X 10.8.2上。我输入了我的
postgres
用户密码,因此无法连接。如何重置密码?

修改/Library/PostgreSQL/9.2/data/pg_hba.conf

-local all all   md5
+local all all   trust
重新启动postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
连接到postgres:

psql
psql内部(
\q
退出):

向后修改pg_hba.conf

+local all all   md5
-local all all   trust
重新启动postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/

更改pg_hba.conf后,无需重新启动Postgres。您只需要使用
pg_ctl reload
重新加载它。我必须在右postgres根目录中设置pg_DATA=
pwd
/DATA才能运行pg_ctl restart。