MySQL connection error 1049

Hello.
I’m new to Grafana and I’m having trouble setting up the connection to mysql. Could anyone help?

  • Grafana windows version
  • MySQL 5.7.18

My configuration on “custom.ini” file is:

#################################### Database ####################################
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as seperate properties or as on string using the url propertie.

# Either “mysql”, “postgres” or “sqlite3”, it’s your choice
;type = sqlite3
;host = 127.0.0.1:3306
;name = grafana
;user = root
;password =

# If the password contains # or ; you have to wrap it with trippel quotes. Ex “”"#password;"""

type = mysql
host = localhost:3306
name = grafana
user = grafana
password = grafana

# Use either URL or the previous fields to configure the database
# Example: mysql://user:secret@host:port/database
;url = mysql://grafana:grafana@localhost:3306/grafana

# For “postgres” only, either “disable”, “require” or “verify-full”
;ssl_mode = disable

# For “sqlite3” only, path relative to data_path setting
;path = grafana.db

# Max conn setting default is 0 (mean not set)
;max_conn =
;max_idle_conn =
;max_open_conn =

#################################### Session ####################################
[session]
# Either “memory”, “file”, “redis”, “mysql”, “postgres”, default is “file”
;provider = file
provider = mysql

# Provider config options
# memory: not have any config yet
# file: session dir path, is relative to grafana data_path
# redis: config like redis server e.g. addr=127.0.0.1:6379,pool_size=100,db=grafana
# mysql: go-sql-driver/mysql dsn config string, e.g. user:password@tcp(127.0.0.1:3306)/database_name
# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
;provider_config = sessions
provider_config = grafana:grafana@tcp(localhost:3306)/grafana
provider = mysql

# Session cookie name
;cookie_name = grafana_sess

# If you use session in https only, default is false
;cookie_secure = false

# Session life time, default is 86400
;session_life_time = 86400

It is returning error as below:

C: \ Users \ joel.costa \ Downloads \ grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 \ bin> grafana-server.exe
[32mINFO [0m [04-16 | 20: 03: 42] Starting Grafana [32mlogger [0m = main [32mversion [0m = 4.2.0 [32mcommit [0m = 349f3eb93 [32mcompiled [ 0m = 2017-03-22T07: 06: 41-0300
[32mINFO [04-16 | 04: 03: 42] Config loaded from [32mlogger [0m = settings [32mfile [0m = "C: \ Users \ joel.costa \ Downloads \ \ Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 / conf / defaults.ini "
[32mINFO [04-16 | 04: 03: 42] Config loaded from [32mlogger [0m = settings [32mfile [0m = "C: \ Users \ joel.costa \ Downloads \ \ Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 \ conf \ custom.ini "
[32mINFO [04-16 | 20: 03: 42] Path Home [32mlogger [0m = settings [32mpath [0m = "C: \ Users \ joel.costa \ Downloads \ Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 "
[32mINFO [04-16 | 20: 03: 42] Path Data [32mlogger [0m = settings [32mpath [0m = “C: \ Users \ joel.costa \ Downloads \” Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 \ data "
[32mINFO [04-16 | 04: 03: 42] Path Logs [32mlogger [0m = settings [32mpath [0m = "C: \ Users \ joel.costa \ Downloads \ Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 \ data \ log "
[32mINFO [04-16 | 04: 03: 42] Path Plugins [32mlogger [0m = settings [32mpath [0m = "C: \ Users \ joel.costa \ Downloads \ Grafana-4.2.0.windows-x64 (1) \ grafana-4.2.0 \ data \ plugins "
[32mINFO [04-16 | 20: 03: 42] Initializing DB [32mlogger [0m = sqlstore [32mdbtype [0m = mysql
[32mINFO [0m [04-16 | 20: 03: 42] Starting DB migration [32mlogger [0m = migrator
Failed to initialize orm engine [31mlogger [0m = sqlstore [31merror [0m = “Sqlstore :: Migration failed err: Error 1049: Unknown database” ‘Grafana’ \ n "

Thank you!!

Is there a database called grafana on your mysql server?

Yes, but I had not created “Schema: grafana”. Connecting now. Thank you!