【发布时间】:2017-10-10 08:16:19
【问题描述】:
我正在尝试找出或重置我的 PostgreSQL 密码,我不知道,但我需要该密码才能将我的数据库从 SQLite3 迁移到 PostgreSQL。
我试图找到 hba_conf 文件,所以在我输入的终端中:
ps aux | grep postgres
我发现我需要找到的目录是:
/Library/PostgreSQL/9.6/bin/postmaster -D/Library/PostgreSQL/9.6/data
我现在的问题是无法找到此文件,因为它显然不存在!当我 cd 到 Library 时,我无法继续前进,因为没有列出 PostgreSQL 文件夹。
这对我来说有点死胡同,因为我不知道为什么没有 PostgreSQL。 PSQL 随我的 Rails 版本一起提供,我对其进行了更新。当我在终端中输入:“psql -V”时,答案是“psql (PostgreSQL) 9.6.3”。
非常感谢您的帮助,谢谢:-)
从库文件夹中,如果我运行“sudo su”然后输入 ls,我会得到以下信息:
.localized Calendars Dictionaries Internet Plug-Ins
Maps Saved Application State WebKit
Accounts CallServices Favorites Keyboard
Messages Screen Savers com.apple.nsurlsessiond
Address Book Plug-Ins ColorPickers FontCollections
Keyboard Layouts Metadata Services iMovie
Application Scripts Colors Fonts KeyboardServices
Passes Sharing
Application Support Compositions GameKit Keychains
PreferencePanes Sounds
Assistant Containers Google LanguageModeling
Preferences Spelling
Assistants Cookies Group Containers LaunchAgents
Printers Suggestions
Audio CoreData IdentityServices Logs
PubSub SyncedPreferences
Caches CoreFollowUp Input Methods Mail
Safari Voices
如果我输入 ps 我会得到:
PID TTY TIME CMD
359 ttys000 0:00.02 login -pfl robertosullivan /bin/bash -c exec -
la bash /bin/bash
3267 ttys000 0:00.02 sudo su
3269 ttys000 0:00.01 su
3270 ttys000 0:00.00 sh
3271 ttys000 0:00.00 ps
如果我尝试 'sudo find / -name psql' - 我得到:
find: /dev/fd/Library: No such file or directory
find: /dev/fd/Library: No such file or directory
/Library/PostgreSQL/9.6/bin/psql
/usr/local/bin/psql
/usr/local/Cellar/postgresql/9.6.3/bin/psql
当我尝试 'sudo find /Library/PostgreSQL/9.6/data -name *.conf' 时,我得到:
/Library/PostgreSQL/9.6/data/pg_hba.conf
/Library/PostgreSQL/9.6/data/pg_ident.conf
/Library/PostgreSQL/9.6/data/postgresql.auto.conf
/Library/PostgreSQL/9.6/data/postgresql.conf
【问题讨论】:
-
将
/Library/PostgreSQL/9.6/data列为sudo用户 -
对不起-我忘了说我在输入'sudo su'后也试图找到这个,但结果相同
-
为什么你认为文件夹是
/Library/PostgreSQL/9.6/data那么呢?.. 我没有看到在 ps 输出中运行 postgres?.. -
我在这个网站上关注了一个帖子,告诉我这是找到 conf_hba 文件的方法。直到你提到它,我才知道 ps,我只是想找到我的 PSQL 密码。
-
但我确实使用“brew services stop/restart postgresql”停止并重新启动 psql - 尽管这在 ps 之后呈现相同的结果
标签: ruby-on-rails macos postgresql