Issue
I am new to this forum, i am facing this issue, where i get the below error.
sudo -u shahid ./pg_ctl -D /root/pgsql10x/data/ initdb
invalid binary "/root/pgsql10x/bin/pg_ctl"
invalid binary "/root/pgsql10x/bin/pg_ctl"
invalid binary "/root/pgsql10x/bin/pg_ctl"
The program "initdb" is needed by pg_ctl but was not found in the same directory as "pg_ctl".
Check your installation.
I am trying to run this from root.
I have built from the source. I am trying version 10. on CentOS7. I downloaded direct from postgres site.
I am not facing this problem when I run as non-root user.
I have all the files in the bin directory, as shared in image here:
Solution
Finally, I was able to resolve the issue.
The problem was due to the built source was directly placed in "/root/" directory as /root/pgsql10x/ in root login.
when i placed it in "/app/" directory as /app/pgsql10x/ things started working normally, database got created and database got working without any problem (in root login).
-Shahid
Answered By - Mohammed Shahid Nawaz Answer Checked By - Terry (WPSolving Volunteer)