9

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?

3
  • 9
    Try forward slashes \i c:/Users/Asus/Desktop/Projects/Movies/solution.sql Commented Jul 27, 2021 at 14:07
  • 1
    I encountered the same problem, but after spending an hour searching the web, I stumbled upon your comment and your solution worked perfectly for me. Thank you so much for sharing! @a_horse_with_no_name Commented Jan 10, 2023 at 9:56
  • Using the forward slashes worked for me!!!!! no more Perms DENIED! TYVM Commented Oct 31 at 14:02

3 Answers 3

14

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.

Sign up to request clarification or add additional context in comments.

1 Comment

i still see the same error despite using forward slashes :/
0

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'

Comments

0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.