Reputation: 469
I am using Windows 10
I have a PostgreSQL file when I run inside the PSQL CMD
\i FILENAMEPATH
postgres=# \i C:\Users\Asus\Desktop\Projects\Movies\solution.sql
C:: Permission denied
I get that Permission Denied
C:: Permission denied
Is there a way around this? Or how can I gain permission?
Upvotes: 9
Views: 13192
Reputation: 559
In my situation, when attempting to execute the initdb command, I encountered a permission denied error. To resolve this issue, I created a folder within my account's directory, and then the command executed successfully.
PS D:\Software\PostgreSQL\bin> .\pg_ctl initdb -D "C:\Users\(my user name)\postgresql_data"
Upvotes: 0
Reputation: 1
What solved this issue for me is opening a PowerShell in the folder location of the sql file (in folder: shift + right-click -> open PowerShell here), to avoid having to provide a file path, and then running '\i filename.sql'
Upvotes: 0
Reputation: 1532
As a_horse_with_no_name pointed out, using forward slashes
instead of backslashes in the address solves the problem.
This is because windows unlike most OSs, resolves paths with forward slashes.
Upvotes: 14