Create / drop database not working #836
Comments
I don’t understand the language of the error message, but I think it’s telling you that it can’t authenticate the user/password in Postgres. Make sure it exists and has the right permissions in Postgres. |
@markbates It's french for "Bad password authentication for user 'user'", then "The "'user' database doesn't exist". @Ibrahimous Check your credentials with a postgresql client. |
Hi, thanks for your fast as light answer: here is the translation: couldn't drop database myApp_test: error dropping PostgreSQL database myApp_test: pq: failed authentication for user « user » The problem isn't that the user doesn not exist, the problem is that, as mentionned above, the URL states: url: {{envOr "DATABASE_URL" "postgres://user:password@127.0.0.1:5432/myApp_production?sslmode=disable"}}` And that buffalo thinks that user is a database |
@stanislas-m I'm currently connected with "user": the problem doesn't lie in wrong credentials |
@Ibrahimous |
Thanks @stanislas-m, but no, the particular doesn't work better that the general^^ Error: couldn't create database authrecipe_development: error creating PostgreSQL database authrecipe_development: pq: la base de données « red-teamer » n'existe pas $ cat database.yml ... P.S. : I'm trying to use: https://github.com/gobuffalo/authrecipe |
@Ibrahimous It works well on my Linux machine:
can you get the output of |
$ buffalo info Buffalo Versionv0.10.2 App InformationPwd=<user_home>/DEV/Go/src/github.com/authrecipe Go Versiongo version go1.9.2 linux/amd64 Go EnvGOARCH="amd64" Node Versionv8.9.4 NPM Version5.6.0 Yarn Version1.3.2 Dep Versiondep Not Found Dep Statusdep Not Found PostgreSQL VersionPostgreSQL Not Found MySQL Versionmysql Ver 14.14 Distrib 5.5.58, for debian-linux-gnu (x86_64) using readline 6.3 SQLite Version3.8.7.1 2014-10-29 13:59:56 3b7b72c4685aa5cf5e675c2c47ebec10d9704221 |
Not sure if this is related but it's not working for me either, only the error doesn't make sense: ERRO[0000] Error: couldn't create database vuerecipe: error creating PostgreSQL database vuerecipe: pq: database "robvdl" does not exist What doesn't make sense in the error is that "robvdl" is not my db name, it's my username, so why it is saying "database robvdl does not exist" is beyond me, the db name is "vuerecipe" and username "robvdl". I am getting the same error when doing a buffalo db drop. buffalo db drop -a I have made sure the robvdl user can log in with password and has createdb privileges, so not sure, this should be working. If i manually create the databases and run buffalo db migrate it's fine and creates tables, it just seems to have issues creating databases and dropping them. |
I have made the logging capabilities & createdb privileges checks as well. |
@robvdl @Ibrahimous Can you upgrade buffalo (and pop) to the latest version?
I can't reproduce your problem on my setup, so either it was fixed, or your database has a different config. |
I did ugrade both pop and buffalo, but unfortunately I still get the same problem, the error message still doesn't make sense when it says database "robvdl" does not exist when that is the user, NOT the database:
|
@robvdl @Ibrahimous Can you try to patch the func (p *postgresql) urlWithoutDb() string {
c := p.ConnectionDetails
ssl := defaults.String(c.Options["sslmode"], "disable")
var s string
if c.Password == "" {
s = "postgres://%s@%s:%s?sslmode=%s"
return fmt.Sprintf(s, c.User, c.Host, c.Port, ssl)
}
s = "postgres://%s:%s@%s:%s?sslmode=%s"
return fmt.Sprintf(s, c.User, c.Password, c.Host, c.Port, ssl)
} Then |
@robvdl @Ibrahimous Any news on this problem? :) |
I have found work around:
createdb my_postgres_username
buffalo db create -a And on my machine it completed, hopefully it will on yours |
@StupidCodeFactory work around works. Thanks. |
See: gobuffalo/buffalo#836 If the db is not precised, postgresql takes the username as the database to connect on. To avoid a connection problem if the user db is not here, we use the default "postgres" db, just like the other client tools do.
I've reproduced the problem on another computer, with a brand new postgresql install. It seems postgresql assumes the db name to be the same as the username, if not provided: that's why you see "pq: database "username" does not exist". By hardcoding the db to postgres (just like other postgresql clients), it works. See gobuffalo/pop#31 |
@Ibrahimous Please update to Pop v4.2.2, it should work fine. |
Hi there,
Thanks for your work, at first :)
I ran into problems just executing the following command:
$ buffalo create db -a
OR
$ buffalo db drop -a
I have the following database.yml:
I get:
Meaning: buffalo seems to understand postgres://user:password as postgres://DATABASEr:password !
Any help, please ?
The text was updated successfully, but these errors were encountered: