Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

default installation doesn't recognize driver mariadb #1938

Closed
L1ghtman2k opened this issue Apr 7, 2020 · 9 comments
Closed

default installation doesn't recognize driver mariadb #1938

L1ghtman2k opened this issue Apr 7, 2020 · 9 comments
Labels
# chkme s: triage Some tests need to be run to confirm the issue

Comments

@L1ghtman2k
Copy link

L1ghtman2k commented Apr 7, 2020

Description

Unable to use mariadb

Steps to Reproduce the Problem

Please describe in painful detail what you did (so others can play along with you) to get to this point. This includes things like the exact command(s) you used, or the curl command you used, that sort of thing.

  1. Create a new project using buffalo new cokemariadb --db-type mariadb
  2. Perform an appropriate setup of MariaDB
  3. Run buffalo pop create -a as suggested in README.md

Expected Behavior

Buffalo populates the MariaDB database

Actual Behavior

buffalo pop create -a
v5.0.11

[POP] 2020/04/07 02:57:16 ←[33minfo - create cokemaria_development (root:password_goes_here@(localhost:3306)/cokemaria_development?readTimeout=3s&collation=utf8mb4_general_ci&parseTime=true&multiStatements=true)←[0m
Error: couldn't create database cokemaria_development: error creating MySQL database cokemaria_development: sql: unknown driver "mariadb" (forgotten import?)
Usage:
  buffalo-pop pop create [flags]

Flags:
  -a, --all    Creates all of the databases in the database.yml
  -h, --help   help for create

Global Flags:
  -c, --config string   The configuration file you would like to use.
  -d, --debug           Use debug/verbose mode
  -e, --env string      The environment you want to run migrations against. Will use $GO_ENV if set. (default "development")
  -p, --path string     Path to the migrations folder (default "./migrations")

couldn't create database cokemaria_development: error creating MySQL database cokemaria_development: sql: unknown driver "mariadb" (forgotten import?)
Usage:
  buffalo pop [flags]

Aliases:
  pop, db

Flags:
  -h, --help   help for pop

time="2020-04-07T02:57:16-04:00" level=error msg="Error: exit status 1"

Info

Please run buffalo info and paste the information below where it says "PASTE_HERE".

PS C:\Users\aibek\go\src\testBuffaloApp\cokemaria> buffalo info
-> Go: Checking installation
←[32m✓ The `go` executable was found on your system at: C:\Go\bin\go.exe←[0m

-> Go: Checking minimum version requirements
←[32m✓ Your version of Go, 1.13.9, meets the minimum requirements.←[0m

-> Go: Checking Package Management
←[32m✓ You are using Go Modules (`go`) for package management.←[0m

-> Go: Checking PATH
←[32m✓ Your PATH contains C:\Users\aibek\go/bin.←[0m

-> Node: Checking installation
←[32m✓ The `node` executable was found on your system at: C:\Program Files\nodejs\node.exe←[0m

-> Node: Checking minimum version requirements
←[32m✓ Your version of Node, v12.16.1, meets the minimum requirements.←[0m

-> NPM: Checking installation
←[32m✓ The `npm` executable was found on your system at: C:\Program Files\nodejs\npm.cmd←[0m

-> NPM: Checking minimum version requirements
←[32m✓ Your version of NPM, 6.13.4, meets the minimum requirements.←[0m

-> Yarn: Checking installation
←[32m✓ The `yarnpkg` executable was found on your system at: C:\Program Files (x86)\Yarn\bin\yarnpkg.cmd←[0m

-> Yarn: Checking minimum version requirements
←[32m✓ Your version of Yarn, 1.22.4, meets the minimum requirements.←[0m

-> PostgreSQL: Checking installation
←[31m✘ The `postgres` executable could not be found on your system.←[0m
For help setting up your Postgres environment please follow the instructions for you platform at:

https://www.postgresql.org/download/

-> MySQL: Checking installation
←[32m✓ The `mysql` executable was found on your system at: C:\Program Files\MariaDB 10.4\bin\mysql.exe←[0m

-> MySQL: Checking minimum version requirements
←[32m✓ Your version of MySQL, 15.1, meets the minimum requirements.←[0m

-> SQLite3: Checking installation
←[31m✘ The `sqlite3` executable could not be found on your system.←[0m
For help setting up your SQLite3 environment please follow the instructions for you platform at:

https://www.sqlite.org/download.html

-> Cockroach: Checking installation
←[32m✓ The `cockroach` executable was found on your system at: C:\WINDOWS\system32\cockroach.exe←[0m

-> Cockroach: Checking minimum version requirements
←[32m✓ Your version of Cockroach, 19.2.5, meets the minimum requirements.←[0m

-> Buffalo (CLI): Checking installation
←[32m✓ The `buffalo` executable was found on your system at: C:\ProgramData\chocolatey\bin\buffalo.exe←[0m

-> Buffalo (CLI): Checking minimum version requirements
←[32m✓ Your version of Buffalo (CLI), v0.16.2, meets the minimum requirements.←[0m

-> Buffalo: Application Details
Pwd         C:\Users\aibek\go\src\testBuffaloApp\cokemaria
Root        C:\Users\aibek\go\src\testBuffaloApp\cokemaria
GoPath      C:\Users\aibek\go
PackagePkg  testBuffaloApp/cokemaria
ActionsPkg  testBuffaloApp/cokemaria/actions
ModelsPkg   testBuffaloApp/cokemaria/models
GriftsPkg   testBuffaloApp/cokemaria/grifts
WithModules true
Name        cokemaria
Bin         bin\cokemaria
VCS         git
WithPop     true
WithSQLite  false
WithDep     false
WithWebpack true
WithNodeJs  true
WithYarn    true
WithDocker  true
WithGrifts  true
AsWeb       true
AsAPI       false
InApp       true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}

-> Buffalo: config/buffalo-app.toml
name = "cokemaria"
bin = "bin\\cokemaria"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false

-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v2"

-> Buffalo: go.mod
module testBuffaloApp/cokemaria

go 1.14

require (
        github.com/gobuffalo/buffalo v0.15.5
        github.com/gobuffalo/buffalo-pop/v2 v2.0.5
        github.com/gobuffalo/envy v1.9.0
        github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
        github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
        github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4
        github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525
        github.com/gobuffalo/packr/v2 v2.8.0
        github.com/gobuffalo/pop/v5 v5.0.11
        github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c
)
@paganotoni
Copy link
Member

@stanislas-m @mclark4386 do you guys have an idea of what could be happening here?

@paganotoni paganotoni added the s: triage Some tests need to be run to confirm the issue label Apr 8, 2020
@mclark4386
Copy link
Member

Would you mind posting your database.yml? I'm guessing you have a mariadb as the protocol, if you switch that to mysql I think it will work... worth a try if you haven't gotten this fixed by now^^;

@L1ghtman2k
Copy link
Author

database.yml:

---
development:
  dialect: "mariadb"
  database: "cokemariadb_development"
  host: "localhost"
  port: "3306"
  user: "root"
  password: "root"

test:
  dialect: "mariadb"
  #
  # You can use a single URL string for the same configuration:
  #
  #url: "mysql://root:root@(localhost:3306)/cokemariadb_test?parseTime=true&multiStatements=true&readTimeout=3s"
  #
  # Note that if you use `url`, other configurations are silently ignored.
  # In this case, the URL must contain all required connection parameters.
  #
  database: "cokemariadb_test"
  host: "localhost"
  port: "3306"
  user: "root"
  password: "root"

production:
  #
  # You can also use environmental variables to override values in this config.
  #
  #url: {{envOr "DATABASE_URL" "mysql://root:root@(localhost:3306)/cokemariadb_production?parseTime=true&multiStatements=true&readTimeout=3s"}}
  #
  dialect: "mariadb"
  database: "cokemariadb_production"
  host: {{envOr "DATABASE_HOST" "localhost"}}
  port: {{envOr "DATABASE_PORT" "3306"}}
  user: {{envOr "DATABASE_USER" "root"}}
  password: {{envOr "DATABASE_PASSWORD" "root"}}
  #
  # And you can also override connection parameters by setting it under options.
  #
  #options:
  #  parseTime: true
  #  multiStatements: true
  #  readTimeout: 3s
  #  collation: "utf8mb4_general_ci"
  #
  # CAUTION!
  #   `parseTime` and` multiStatements` must be set to `true` to work properly.
  #   If you are not sure, do not change (or set) these values.

Yeap, switching to MySQL worked, however, it seems like buffalo new does present the option to use mariadb as a database type:

Creates a new Buffalo application

Usage:
  buffalo new [name] [flags]

Flags:
      --api                  skip all front-end code and configure for an API server
      --ci-provider string   specify the type of ci file you would like buffalo to generate [none, travis, gitlab-ci] (default "none")
      --config string        config file (default is $HOME/.buffalo.yaml)
      --db-type string       specify the type of database you want to use [cockroach, mariadb, mysql, postgres] (default "postgres")
      --docker string        specify the type of Docker file to generate [none, multi, standard] (default "multi")
  -d, --dry-run              dry run
  -f, --force                delete and remake if the app already exists
  -h, --help                 help for new
      --module string        specify the root module (package) name. [defaults to 'automatic']
      --skip-config          skips using the config file
      --skip-pop             skips adding pop/soda to your app
      --skip-webpack         skips adding Webpack to your app
      --skip-yarn            use npm instead of yarn for frontend dependencies management
      --vcs string           specify the Version control system you would like to use [none, git, bzr] (default "git")
  -v, --verbose              verbosely print out the go get commands

Also, here is a mod file:

go 1.14

require (
	github.com/gobuffalo/buffalo v0.15.5
	github.com/gobuffalo/buffalo-pop/v2 v2.0.5
	github.com/gobuffalo/envy v1.9.0
	github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
	github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
	github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4
	github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525
	github.com/gobuffalo/packr/v2 v2.8.0
	github.com/gobuffalo/pop/v5 v5.0.11
	github.com/gobuffalo/suite v2.8.2+incompatible
	github.com/gobuffalo/validate/v3 v3.1.0
	github.com/gofrs/uuid v3.2.0+incompatible
	github.com/markbates/grift v1.5.0
	github.com/pkg/errors v0.9.1
	github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c
	golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a
)

Maybe somehow the version if off?

@mclark4386
Copy link
Member

I think you may be one of the first people to try generating with it... would love some help there if you feel comfortable!

@emhohensee
Copy link

Seeing the same thing here. Running buffalo dev on a freshly generated Buffalo 0.16.5 project (buffalo new myproject --api --db-type mariadb) yields the error below.

2020/04/20 13:14:23 couldn't open connection for development: could not open database connection: sql: unknown driver "mariadb" (forgotten import?)

@OnePieceLv
Copy link

OnePieceLv commented Apr 23, 2020

me too.
I received this error 2020/04/23 22:42:00 couldn't open connection for development: could not open database connection: sql: unknown driver "mariadb (forgotten import?)" when running cmd buffalo dev

@Jeraimee
Copy link

Currently building project using buffalo along with mariadb. Since I can run a couple different projects to test I'd be happy to help track this down. If it matters, by generation was fine (using api switch) but tests don't run (import issue).

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@sio4 sio4 added the # chkme label Sep 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
# chkme s: triage Some tests need to be run to confirm the issue
Projects
None yet
Development

No branches or pull requests

7 participants