-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The database for Hello.Repo couldn't be created: ERROR 42501 (insufficient_privilege): permission denied to create database #2435
Comments
You need to create a user with permission to do this in Postgres. You can Google for how 👍🏻 |
@aphillipo thanks for your reply, but how can I know the name of the postgresql user? |
@TangMonk This isn't an issue with Phoenix and the error message is okay - Postgresql support is beyond the scope of the phoenix framework issue tracker - it says the following when you create an issue:
But seeing as people might Google and find your issue, hopefully stopping them from re-reporting it I'll explain here:
...
# Configure your database
config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
username: "phoenix-database-user",
password: "some-random-password",
database: "the-database",
hostname: "localhost",
pool_size: 10
... To create a new Postgres role/user you can follow the instructions here: Probably just type: createuser --interactive -P And follow the instructions. Please close this and seek further help on slack, IRC or the elixir forums! Thanks! |
@aphillipo ❤️ 💚 💙 💛 💜 |
@aphillipo thanks! but I think the official doc should be improved when execute command In https://hexdocs.pm/phoenix/up_and_running.html#content:
change to:
that's will more friendly for beginners without interrupted learning when occurs this problem |
Seems reasonable @TangMonk - you can find the guide here: I'm sure making that clearer would be accepted, but create a pull request there and see if they like it. Shouldn't take long! |
same here, could use default? |
definite solution:
|
If user already exists, then changing permissions might help.
|
It's weird, I don't recall anything in the guide actually telling me how to do this bit... I'm sure I should have seen something somewhere. I feel like every potentially smooth new language/framework introduction is hindered by an hour long tromp to get a database up and running. It's especially annoying because creating a database is such an infrequent thing that the commands to do it are forgotten so easily. Surely there must be some common resource that we can just point people at to get the initial postgres install working as smoothly as possible? |
Hey guys, i have been struggling with that. It looks like there is very specific way how postgres works. So since i am newbie to Phoenix/Elixir/Postgres stack i decided to test and experiment. My goal was to get non priveledged user created in the database and provide the credentials to the phx app. I am using PSQL 9.1. The difference to make it work was executing the create database command with additional options as follows: Connect to psql with the master potgres account and perform the commands below. In my case i was trying to get the demo task_app so assuming my user will be taskapp, database taskapp and password set to the same: #Create the user: #create the database: #Set the user password: #Set privilidges: #and give the user the option to create databases: Without the last line my phx app wasn't willing to create the tables. With it all went well. I hope that can be better starting point for other lost souls as myself. |
Easy and effective solution. |
👀 I came here from Google |
Environment
I am following official guides to create a phoenix project, when I running following commands:
it throw the error to me, But I check the files permissions, it is fine
The text was updated successfully, but these errors were encountered: