0

Hi all~~ I'm only 3 month into the coding scene, so forgive my ignorance.

Environment: ruby 2.3.3/rails 5.1/PG9.6.1 installed through homebrew on Mac OSX

My Goal: Trying to build a production ready rails app using Latest postgresql

Problem: as soon as I deployed my rails project and start testing my local server, I ran into "PG::ConnectionBad"/"fe_sendauth: no password supplied"/ @connection = PGconn.connect(@connection_parameters) . error

What I trying to do: I learned I need to config my pg_hba.conf file to set one of the encrypt method to MD5. via suggestion here

Rails + Postgres fe_sendauth: no password supplied

Progress: I was able to locate pg_hba.conf's directory by type in "locate pg_hba.conf"

It's in /Users/mypcname/PostgreSQL/pg96/init/pg_hba.conf

But now I can't find a way to execute the file to do the editing

Usually type in file's extension would let me exceute the file, but in this cause, it says someone about "superuser session", so I tried sudo su /Users/mypcname/PostgreSQL/pg96/init/pg_hba.conf

And got this

su: unknown login: /Users/mypcname/PostgreSQL/pg96/init/pg_hba.conf

So this is where I got stuck, any help and suggestion would be greatly appreciated, thanks in advance

GrumpyCrouton
  • 8,486
  • 7
  • 32
  • 71
  • do you have pgAdminIII installed? – Neil McGuigan Feb 27 '17 at 19:51
  • It's a text file, you don't "execute" it. You can open and edit that with any text editor in your system. But neither `sudo` nor `su` is an editor, both commands are only to change the current user. –  Feb 27 '17 at 20:17
  • @NeilMcGuigan have no idea I need to install that, I will see into it now, so my postgresql won't launch without it? I thought I only needs to change a file's encryption method to MD5 in PG_hba.conf? – user7433164 Feb 27 '17 at 20:25
  • @a_horse_with_no_name I see what you are saying, but my problem is, without terminal I can't find the /Users/mypcname/PostgreSQL/pg96/init/pg_hba.conf manually anywhere on my Mac, so i tried to open this text file with terminal command which doesn't yield any result – user7433164 Feb 27 '17 at 20:33
  • Use `vi` or something similar on the command line, but I don't understand why you can't just open that file in a regular text editor. Surely there must be something like "File Open" in OSX where you can paste the full filename. –  Feb 27 '17 at 20:36
  • @a_horse_with_no_name I tried, but I think in Postgres v9.6.1, pg_hba.conf is no longer a text file, the whole psql folder became a mini terminal app(where used to contain pg_hba.conf) so I can't locate & open the file in text editor . (everything used to be fine in v9.4 and rails 4) – user7433164 Feb 28 '17 at 18:33
  • All `.conf` files in Postgres **are** text files. I have no idea what you mean with "*the folder became a terminal app*". A folder is not an "app". If that is a "folder" and you can see the file, then right click on the file (or whatever the corresponding thing on the Mac is) and edit it. If it's a "terminal" then navigate to the folder and use e.g.`vi pg_hba.conf` (or whatever command line editor the Mac has) –  Feb 28 '17 at 18:44
  • Applications on OSX often seem to be one single file but in fact they contain several folders with many files. I expect that when you right click on the "mini terminal app" you mention that you have an option called something like "show package content" which will show you what is inside. – Eelke Sep 12 '17 at 17:59

0 Answers0