Code Monkey home page Code Monkey logo

dokku-mysql's Introduction

dokku mysql Build Status IRC Network

Official mysql plugin for dokku. Currently defaults to installing mysql 8.3.0.

Requirements

  • dokku 0.19.x+
  • docker 1.8.x

Installation

# on 0.19.x+
sudo dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql

Commands

mysql:app-links <app>                              # list all mysql service links for a given app
mysql:backup <service> <bucket-name> [--use-iam]   # create a backup of the mysql service to an existing s3 bucket
mysql:backup-auth <service> <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url> # set up authentication for backups on the mysql service
mysql:backup-deauth <service>                      # remove backup authentication for the mysql service
mysql:backup-schedule <service> <schedule> <bucket-name> [--use-iam] # schedule a backup of the mysql service
mysql:backup-schedule-cat <service>                # cat the contents of the configured backup cronfile for the service
mysql:backup-set-encryption <service> <passphrase> # set encryption for all future backups of mysql service
mysql:backup-unschedule <service>                  # unschedule the backup of the mysql service
mysql:backup-unset-encryption <service>            # unset encryption for future backups of the mysql service
mysql:clone <service> <new-service> [--clone-flags...] # create container <new-name> then copy data from <name> into <new-name>
mysql:connect <service>                            # connect to the service via the mysql connection tool
mysql:create <service> [--create-flags...]         # create a mysql service
mysql:destroy <service> [-f|--force]               # delete the mysql service/data/container if there are no links left
mysql:enter <service>                              # enter or run a command in a running mysql service container
mysql:exists <service>                             # check if the mysql service exists
mysql:export <service>                             # export a dump of the mysql service database
mysql:expose <service> <ports...>                  # expose a mysql service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)
mysql:import <service>                             # import a dump into the mysql service database
mysql:info <service> [--single-info-flag]          # print the service information
mysql:link <service> <app> [--link-flags...]       # link the mysql service to the app
mysql:linked <service> <app>                       # check if the mysql service is linked to an app
mysql:links <service>                              # list all apps linked to the mysql service
mysql:list                                         # list all mysql services
mysql:logs <service> [-t|--tail] <tail-num-optional> # print the most recent log(s) for this service
mysql:pause <service>                              # pause a running mysql service
mysql:promote <service> <app>                      # promote service <service> as DATABASE_URL in <app>
mysql:restart <service>                            # graceful shutdown and restart of the mysql service container
mysql:set <service> <key> <value>                  # set or clear a property for a service
mysql:start <service>                              # start a previously stopped mysql service
mysql:stop <service>                               # stop a running mysql service
mysql:unexpose <service>                           # unexpose a previously exposed mysql service
mysql:unlink <service> <app>                       # unlink the mysql service from the app
mysql:upgrade <service> [--upgrade-flags...]       # upgrade service <service> to the specified versions

Usage

Help for any commands can be displayed by specifying the command as an argument to mysql:help. Plugin help output in conjunction with any files in the docs/ folder is used to generate the plugin documentation. Please consult the mysql:help command for any undocumented commands.

Basic Usage

create a mysql service

# usage
dokku mysql:create <service> [--create-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -m|--memory MEMORY: container memory limit in megabytes (default: unlimited)
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -p|--password PASSWORD: override the user-level service password
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -r|--root-password PASSWORD: override the root-level service password
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mysql docker container

Create a mysql service named lollipop:

dokku mysql:create lollipop

You can also specify the image and image version to use for the service. It must be compatible with the mysql image.

export MYSQL_IMAGE="mysql"
export MYSQL_IMAGE_VERSION="${PLUGIN_IMAGE_VERSION}"
dokku mysql:create lollipop

You can also specify custom environment variables to start the mysql service in semicolon-separated form.

export MYSQL_CUSTOM_ENV="USER=alpha;HOST=beta"
dokku mysql:create lollipop

print the service information

# usage
dokku mysql:info <service> [--single-info-flag]

flags:

  • --config-dir: show the service configuration directory
  • --data-dir: show the service data directory
  • --dsn: show the service DSN
  • --exposed-ports: show service exposed ports
  • --id: show the service container id
  • --internal-ip: show the service internal ip
  • --initial-network: show the initial network being connected to
  • --links: show the service app links
  • --post-create-network: show the networks to attach to after service container creation
  • --post-start-network: show the networks to attach to after service container start
  • --service-root: show the service root directory
  • --status: show the service running status
  • --version: show the service image version

Get connection information as follows:

dokku mysql:info lollipop

You can also retrieve a specific piece of service info via flags:

dokku mysql:info lollipop --config-dir
dokku mysql:info lollipop --data-dir
dokku mysql:info lollipop --dsn
dokku mysql:info lollipop --exposed-ports
dokku mysql:info lollipop --id
dokku mysql:info lollipop --internal-ip
dokku mysql:info lollipop --initial-network
dokku mysql:info lollipop --links
dokku mysql:info lollipop --post-create-network
dokku mysql:info lollipop --post-start-network
dokku mysql:info lollipop --service-root
dokku mysql:info lollipop --status
dokku mysql:info lollipop --version

list all mysql services

# usage
dokku mysql:list

List all services:

dokku mysql:list

print the most recent log(s) for this service

# usage
dokku mysql:logs <service> [-t|--tail] <tail-num-optional>

flags:

  • -t|--tail [<tail-num>]: do not stop when end of the logs are reached and wait for additional output

You can tail logs for a particular service:

dokku mysql:logs lollipop

By default, logs will not be tailed, but you can do this with the --tail flag:

dokku mysql:logs lollipop --tail

The default tail setting is to show all logs, but an initial count can also be specified:

dokku mysql:logs lollipop --tail 5

link the mysql service to the app

# usage
dokku mysql:link <service> <app> [--link-flags...]

flags:

  • -a|--alias "BLUE_DATABASE": an alternative alias to use for linking to an app via environment variable
  • -q|--querystring "pool=5": ampersand delimited querystring arguments to append to the service link
  • -n|--no-restart "false": whether or not to restart the app on link (default: true)

A mysql service can be linked to a container. This will use native docker links via the docker-options plugin. Here we link it to our playground app.

NOTE: this will restart your app

dokku mysql:link lollipop playground

The following environment variables will be set automatically by docker (not on the app itself, so they won’t be listed when calling dokku config):

DOKKU_MYSQL_LOLLIPOP_NAME=/lollipop/DATABASE
DOKKU_MYSQL_LOLLIPOP_PORT=tcp://172.17.0.1:3306
DOKKU_MYSQL_LOLLIPOP_PORT_3306_TCP=tcp://172.17.0.1:3306
DOKKU_MYSQL_LOLLIPOP_PORT_3306_TCP_PROTO=tcp
DOKKU_MYSQL_LOLLIPOP_PORT_3306_TCP_PORT=3306
DOKKU_MYSQL_LOLLIPOP_PORT_3306_TCP_ADDR=172.17.0.1

The following will be set on the linked application by default:

DATABASE_URL=mysql://mysql:SOME_PASSWORD@dokku-mysql-lollipop:3306/lollipop

The host exposed here only works internally in docker containers. If you want your container to be reachable from outside, you should use the expose subcommand. Another service can be linked to your app:

dokku mysql:link other_service playground

It is possible to change the protocol for DATABASE_URL by setting the environment variable MYSQL_DATABASE_SCHEME on the app. Doing so will after linking will cause the plugin to think the service is not linked, and we advise you to unlink before proceeding.

dokku config:set playground MYSQL_DATABASE_SCHEME=mysql2
dokku mysql:link lollipop playground

This will cause DATABASE_URL to be set as:

mysql2://mysql:SOME_PASSWORD@dokku-mysql-lollipop:3306/lollipop

unlink the mysql service from the app

# usage
dokku mysql:unlink <service> <app>

flags:

  • -n|--no-restart "false": whether or not to restart the app on unlink (default: true)

You can unlink a mysql service:

NOTE: this will restart your app and unset related environment variables

dokku mysql:unlink lollipop playground

set or clear a property for a service

# usage
dokku mysql:set <service> <key> <value>

Set the network to attach after the service container is started:

dokku mysql:set lollipop post-create-network custom-network

Set multiple networks:

dokku mysql:set lollipop post-create-network custom-network,other-network

Unset the post-create-network value:

dokku mysql:set lollipop post-create-network

Service Lifecycle

The lifecycle of each service can be managed through the following commands:

connect to the service via the mysql connection tool

# usage
dokku mysql:connect <service>

Connect to the service via the mysql connection tool:

NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098

dokku mysql:connect lollipop

enter or run a command in a running mysql service container

# usage
dokku mysql:enter <service>

A bash prompt can be opened against a running service. Filesystem changes will not be saved to disk.

NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098

dokku mysql:enter lollipop

You may also run a command directly against the service. Filesystem changes will not be saved to disk.

dokku mysql:enter lollipop touch /tmp/test

expose a mysql service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)

# usage
dokku mysql:expose <service> <ports...>

Expose the service on the service's normal ports, allowing access to it from the public interface (0.0.0.0):

dokku mysql:expose lollipop 3306

Expose the service on the service's normal ports, with the first on a specified ip adddress (127.0.0.1):

dokku mysql:expose lollipop 127.0.0.1:3306

unexpose a previously exposed mysql service

# usage
dokku mysql:unexpose <service>

Unexpose the service, removing access to it from the public interface (0.0.0.0):

dokku mysql:unexpose lollipop

promote service as DATABASE_URL in

# usage
dokku mysql:promote <service> <app>

If you have a mysql service linked to an app and try to link another mysql service another link environment variable will be generated automatically:

DOKKU_DATABASE_BLUE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mysql-other-service:3306/other_service

You can promote the new service to be the primary one:

NOTE: this will restart your app

dokku mysql:promote other_service playground

This will replace DATABASE_URL with the url from other_service and generate another environment variable to hold the previous value if necessary. You could end up with the following for example:

DATABASE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mysql-other-service:3306/other_service
DOKKU_DATABASE_BLUE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mysql-other-service:3306/other_service
DOKKU_DATABASE_SILVER_URL=mysql://lollipop:SOME_PASSWORD@dokku-mysql-lollipop:3306/lollipop

start a previously stopped mysql service

# usage
dokku mysql:start <service>

Start the service:

dokku mysql:start lollipop

stop a running mysql service

# usage
dokku mysql:stop <service>

Stop the service and removes the running container:

dokku mysql:stop lollipop

pause a running mysql service

# usage
dokku mysql:pause <service>

Pause the running container for the service:

dokku mysql:pause lollipop

graceful shutdown and restart of the mysql service container

# usage
dokku mysql:restart <service>

Restart the service:

dokku mysql:restart lollipop

upgrade service to the specified versions

# usage
dokku mysql:upgrade <service> [--upgrade-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -R|--restart-apps "true": whether or not to force an app restart (default: false)
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mysql docker container

You can upgrade an existing service to a new image or image-version:

dokku mysql:upgrade lollipop

Service Automation

Service scripting can be executed using the following commands:

list all mysql service links for a given app

# usage
dokku mysql:app-links <app>

List all mysql services that are linked to the playground app.

dokku mysql:app-links playground

create container then copy data from into

# usage
dokku mysql:clone <service> <new-service> [--clone-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -m|--memory MEMORY: container memory limit in megabytes (default: unlimited)
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -p|--password PASSWORD: override the user-level service password
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -r|--root-password PASSWORD: override the root-level service password
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mysql docker container

You can clone an existing service to a new one:

dokku mysql:clone lollipop lollipop-2

check if the mysql service exists

# usage
dokku mysql:exists <service>

Here we check if the lollipop mysql service exists.

dokku mysql:exists lollipop

check if the mysql service is linked to an app

# usage
dokku mysql:linked <service> <app>

Here we check if the lollipop mysql service is linked to the playground app.

dokku mysql:linked lollipop playground

list all apps linked to the mysql service

# usage
dokku mysql:links <service>

List all apps linked to the lollipop mysql service.

dokku mysql:links lollipop

Data Management

The underlying service data can be imported and exported with the following commands:

import a dump into the mysql service database

# usage
dokku mysql:import <service>

Import a datastore dump:

dokku mysql:import lollipop < data.dump

export a dump of the mysql service database

# usage
dokku mysql:export <service>

By default, datastore output is exported to stdout:

dokku mysql:export lollipop

You can redirect this output to a file:

dokku mysql:export lollipop > data.dump

Backups

Datastore backups are supported via AWS S3 and S3 compatible services like minio.

You may skip the backup-auth step if your dokku install is running within EC2 and has access to the bucket via an IAM profile. In that case, use the --use-iam option with the backup command.

Backups can be performed using the backup commands:

set up authentication for backups on the mysql service

# usage
dokku mysql:backup-auth <service> <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url>

Setup s3 backup authentication:

dokku mysql:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY

Setup s3 backup authentication with different region:

dokku mysql:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION

Setup s3 backup authentication with different signature version and endpoint:

dokku mysql:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_SIGNATURE_VERSION ENDPOINT_URL

More specific example for minio auth:

dokku mysql:backup-auth lollipop MINIO_ACCESS_KEY_ID MINIO_SECRET_ACCESS_KEY us-east-1 s3v4 https://YOURMINIOSERVICE

remove backup authentication for the mysql service

# usage
dokku mysql:backup-deauth <service>

Remove s3 authentication:

dokku mysql:backup-deauth lollipop

create a backup of the mysql service to an existing s3 bucket

# usage
dokku mysql:backup <service> <bucket-name> [--use-iam]

flags:

  • -u|--use-iam: use the IAM profile associated with the current server

Backup the lollipop service to the my-s3-bucket bucket on AWS:`

dokku mysql:backup lollipop my-s3-bucket --use-iam

Restore a backup file (assuming it was extracted via tar -xf backup.tgz):

dokku mysql:import lollipop < backup-folder/export

set encryption for all future backups of mysql service

# usage
dokku mysql:backup-set-encryption <service> <passphrase>

Set the GPG-compatible passphrase for encrypting backups for backups:

dokku mysql:backup-set-encryption lollipop

unset encryption for future backups of the mysql service

# usage
dokku mysql:backup-unset-encryption <service>

Unset the GPG encryption passphrase for backups:

dokku mysql:backup-unset-encryption lollipop

schedule a backup of the mysql service

# usage
dokku mysql:backup-schedule <service> <schedule> <bucket-name> [--use-iam]

flags:

  • -u|--use-iam: use the IAM profile associated with the current server

Schedule a backup:

'schedule' is a crontab expression, eg. "0 3 * * *" for each day at 3am

dokku mysql:backup-schedule lollipop "0 3 * * *" my-s3-bucket

Schedule a backup and authenticate via iam:

dokku mysql:backup-schedule lollipop "0 3 * * *" my-s3-bucket --use-iam

cat the contents of the configured backup cronfile for the service

# usage
dokku mysql:backup-schedule-cat <service>

Cat the contents of the configured backup cronfile for the service:

dokku mysql:backup-schedule-cat lollipop

unschedule the backup of the mysql service

# usage
dokku mysql:backup-unschedule <service>

Remove the scheduled backup from cron:

dokku mysql:backup-unschedule lollipop

Disabling docker image pull calls

If you wish to disable the docker image pull calls that the plugin triggers, you may set the MYSQL_DISABLE_PULL environment variable to true. Once disabled, you will need to pull the service image you wish to deploy as shown in the stderr output.

Please ensure the proper images are in place when docker image pull is disabled.

dokku-mysql's People

Contributors

cellane avatar chiedo avatar dependabot[bot] avatar dpanyam avatar ebeigarts avatar flink avatar fruitl00p avatar igormatkovic avatar josegonzalez avatar petewest avatar soham2008xyz avatar srna avatar treythomas123 avatar yourivdlans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dokku-mysql's Issues

Running backup-auth ignores optional config values

I was trying to setup and configure mysql backups with Digital Ocean's new product Spaces (a competitor to S3) and was getting an auth error that the aws api key wasn't found.

After turning dokku trace on, I noticed that the ENDPOINT_URL and other optional config vars weren't being outputted, but skipped during this part of the trace:

+ [[ -f /var/lib/dokku/services/mysql/<app name>/backup/AWS_DEFAULT_REGION ]]
+ [[ -f /var/lib/dokku/services/mysql/<app name>/backup/AWS_SIGNATURE_VERSION ]]
+ [[ -f /var/lib/dokku/services/mysql/<app name>/backup/ENDPOINT_URL ]]

I was able to get the backup to successfully run by manually creating files at the above locations (for region and endpoint_url) with the contents of the file being the required value.

So it seems like the issue is somewhere in the backup-auth command, but I haven't had a chance to do a further trace.

Backups to regions other than eu-east-1 (sorta) work

I just configured the mysql backups to work to a bucket I have in eu-west-1. It worked fine, but then I wanted to change the bucket to London (eu-central-1) and was greeted with this error:

upload failed: - to s3://bucket.name/mysql-app-2017-05-10-10-02-45.tgz 
An error occurred (InvalidRequest) when calling the PutObject operation: 
You are attempting to operate on a bucket in a region that requires 
Signature Version 4.  You can fix this issue by explicitly providing the 
correct region location using the --region argument, the 
AWS_DEFAULT_REGION environment variable, or the region variable in the 
AWS CLI configuration file.  You can get the bucket's location by running 
"aws s3api get-bucket-location --bucket BUCKET"

AWS is lovely int it.

mysql:destroy Not Working

xxx@ip-xxx-31-xxx-243:~$ dokku mysql:list
NAME          VERSION       STATUS   EXPOSED PORTS  LINKS
mwashservice  mysql:5.7.12  running  -              -
xxx@ip-xxx-31-xxx-243:~$ dokku mysql:stop mwashservice
-----> Stopping container
=====> Container stopped
xxx@ip-xxx-31-xxx-243:~$ dokku mysql:destroy mwashservice
 !     WARNING: Potentially Destructive Action
 !     This command will destroy mwashservice MySQL service.
 !     To proceed, type "mwashservice"

> mwashservice
-----> Deleting mwashservice
       Deleting container data
-----> Stopping container
=====> Container stopped
       Removing container
Error response from daemon: You cannot remove a running container 46ff7de20e63dc
51e01c75f65b9620582f4e9739b1d9d0092bf23ca69f0d6225. Stop the container before at
tempting removal or force remove

How do i go about this even after running the stop command several times?

How to configure for log slow queries

Hi, i want to configure mysql to log the slow queries, but i don't find any
example to do it...

I find a note in the readme file that mention the my.cnf file (https://github.com/dokku/dokku-mysql#adding-a-custom-mycnf) but i was wondering how to setup it correctly.

Traditionally [1], i need to set a path value for the log file. Does the mysql-plugin have access to the host filesystem? There is any my.cnf example to explore?

https://confluence.atlassian.com/kb/enabling-mysql-slow-query-logs-772874952.html

Thanks

Expected enviroment variables not found

After installing this plugin, and following the readme to create and link a database with an existing deployed app, I am unable to find the environment variables mentioned in the readme.

To test, I am using dokku enter <app> web and then running the env command. Without the environment vars, I am unsure how to configure my rails app to connect with the database.

Character set

It would be nice to be able to specify character set and collation. Even better would be to being able to specify it as a global default for server and separately by instance. Or at least use utf8 & utf8_general_ci as hard-wired default, as most of the apps use it.

Unable to import mysqldmp ( permissions issue)

I have created a myql service and linked it to my app. I have a MYSQLDUMP file from where i would like to import. The default user "mysql" created as part of setting up the mysql service has no permissions although it is the root user.

I chatted with Savant and he asked me to file this issue. Appreciate if this can be fixed ASAP because we are ready to move to production

root@ip-172-31-0-23:/home/ubuntu# dokku mysql:import main < dump.sql
ERROR 1227 (42000) at line 958: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
root@ip-172-31-0-23:/home/ubuntu#

"ERROR: unable to connect" when ran command "dokku mysql:create lollipop"

I installed dokku-mysql with instruction in this project and tried to create new MySQL database via dokku mysql:create lollipop. However, it always output ERROR: unable to connect at the end of running.

Here is dokku report

-----> uname: Linux dokkuMe 4.13.0-1005-azure #7-Ubuntu SMP Mon Jan 8 21:37:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
              total        used        free      shared  buff/cache   available
Mem:           1907         633         141          31        1132         899
Swap:             0           0           0
-----> docker version:
Client:
 Version:       18.01.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    03596f5
 Built: Wed Jan 10 20:11:05 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.01.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   03596f5
  Built:        Wed Jan 10 20:09:37 2018
  OS/Arch:      linux/amd64
  Experimental: false
-----> docker daemon info:
Containers: 13
 Running: 7
 Paused: 0
 Stopped: 6
Images: 27
Server Version: 18.01.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-1005-azure
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.862GiB
Name: dokkuMe
ID: 4GKM:XFEU:FICM:GFOC:HCHY:64TB:4SDV:AJ2U:ASUG:X4Q4:J6UJ:ZLXK
Docker Root Dir: /var/lib/docker
Debug Mode (client): true
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
-----> sigil version: 0.4.0
-----> herokuish version:
herokuish: 0.3.33
buildpacks:
  heroku-buildpack-multi     v1.0.0
  heroku-buildpack-ruby      v170
  heroku-buildpack-nodejs    v111
  heroku-buildpack-clojure   v77
  heroku-buildpack-python    v120
  heroku-buildpack-java      v57
  heroku-buildpack-gradle    v24
  heroku-buildpack-scala     v79
  heroku-buildpack-play      v26
  heroku-buildpack-php       v126
  heroku-buildpack-go        v78
  heroku-buildpack-erlang    fa17af9
  buildpack-nginx            v8
-----> dokku version: 0.11.3
-----> dokku plugins:
plugn: 0.3.0
  00_dokku-standard    0.11.3 enabled    dokku core standard plugin
  20_events            0.11.3 enabled    dokku core events logging plugin
  apps                 0.11.3 enabled    dokku core apps plugin
  build-env            0.11.3 enabled    dokku core build-env plugin
  certs                0.11.3 enabled    dokku core certificate management plugin
  checks               0.11.3 enabled    dokku core checks plugin
  common               0.11.3 enabled    dokku core common plugin
  config               0.11.3 enabled    dokku core config plugin
  docker-options       0.11.3 enabled    dokku core docker-options plugin
  domains              0.11.3 enabled    dokku core domains plugin
  enter                0.11.3 enabled    dokku core enter plugin
  git                  0.11.3 enabled    dokku core git plugin
  logs                 0.11.3 enabled    dokku core logs plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.11.3 enabled    dokku core named containers plugin
  network              0.11.3 enabled    dokku core network plugin
  nginx-vhosts         0.11.3 enabled    dokku core nginx-vhosts plugin
  plugin               0.11.3 enabled    dokku core plugin plugin
  postgres             1.0.0 enabled    dokku postgres service plugin
  proxy                0.11.3 enabled    dokku core proxy plugin
  ps                   0.11.3 enabled    dokku core ps plugin
  rabbitmq             1.0.0 enabled    dokku rabbitmq service plugin
  repo                 0.11.3 enabled    dokku core repo plugin
  shell                0.11.3 enabled    dokku core shell plugin
  ssh-keys             0.11.3 enabled    dokku core ssh-keys plugin
  storage              0.11.3 enabled    dokku core storage plugin
  tags                 0.11.3 enabled    dokku core tags plugin
  tar                  0.11.3 enabled    dokku core tar plugin

Here is dokku mysql:create lollipop with dokku trace on.

+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args mysql:create lolipop
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=2
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=3
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ mysql:create =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ loginuser != \d\o\k\k\u ]]
+ [[ ! mysql:create =~ plugin:* ]]
+ [[ ! mysql:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
++ id -un
+ export SSH_USER=loginuser
+ SSH_USER=loginuser
+ sudo -u dokku -E -H /usr/bin/dokku mysql:create lolipop
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args mysql:create lolipop
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=2
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=3
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ mysql:create =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ mysql:create =~ ^plugin:.* ]]
+ [[ mysql:create == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ -n '' ]]
+ dokku_auth mysql:create lolipop
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=loginuser
+ SSH_USER=loginuser
+ export SSH_NAME=default
+ SSH_NAME=default
+ plugn trigger user-auth loginuser default mysql:create lolipop
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n 1 ]]
++ basename /var/lib/dokku/plugins/enabled/20_events/user-auth
+ dokku_log_plugn_trigger_call user-auth loginuser default mysql:create lolipop
+ declare 'desc=log plugn trigger calls'
+ local l_hook=user-auth
+ shift
+ dokku_log_event 'INVOKED: user-auth( loginuser default mysql:create lolipop ) NAME= FINGERPRINT='
+ declare 'desc=log dokku events'
+ logger -t dokku -i -- 'INVOKED: user-auth( loginuser default mysql:create lolipop ) NAME= FINGERPRINT='
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ mysql:create =~ (ssh-keys:add|ssh-keys:remove) ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd mysql:create lolipop
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=mysql:create
+ local PLUGIN_CMD=mysql:create
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/mysql
+ [[ /var/lib/dokku/plugins/available/mysql == *core-plugins* ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql:create/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql:create/subcommands/mysql:create ]]
+ [[ -x /var/lib/dokku/plugins/enabled/mysql/subcommands/create ]]
+ [[ -n create ]]
+ /var/lib/dokku/plugins/enabled/mysql/subcommands/create mysql:create lolipop
+ source /var/lib/dokku/plugins/enabled/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/mysql/subcommands/create
+++ cd /var/lib/dokku/plugins/enabled/mysql/subcommands
+++ pwd
++ dirname /var/lib/dokku/plugins/enabled/mysql/subcommands
+ source /var/lib/dokku/plugins/enabled/mysql/functions
++++ dirname /var/lib/dokku/plugins/enabled/mysql/functions
+++ cd /var/lib/dokku/plugins/enabled/mysql
+++ pwd
++ source /var/lib/dokku/plugins/enabled/mysql/config
+++ export MYSQL_IMAGE=mysql
+++ MYSQL_IMAGE=mysql
+++ export MYSQL_IMAGE_VERSION=5.7.12
+++ MYSQL_IMAGE_VERSION=5.7.12
+++ export MYSQL_ROOT=/var/lib/dokku/services/mysql
+++ MYSQL_ROOT=/var/lib/dokku/services/mysql
+++ export PLUGIN_COMMAND_PREFIX=mysql
+++ PLUGIN_COMMAND_PREFIX=mysql
+++ export PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mysql
+++ PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mysql
+++ export PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql
+++ PLUGIN_DATA_ROOT=/var/lib/dokku/services/mysql
+++ PLUGIN_DATASTORE_PORTS=(3306)
+++ export PLUGIN_DATASTORE_PORTS
+++ export PLUGIN_DATASTORE_WAIT_PORT=3306
+++ PLUGIN_DATASTORE_WAIT_PORT=3306
+++ export PLUGIN_DEFAULT_ALIAS=DATABASE
+++ PLUGIN_DEFAULT_ALIAS=DATABASE
+++ export PLUGIN_ALT_ALIAS=DOKKU_MYSQL
+++ PLUGIN_ALT_ALIAS=DOKKU_MYSQL
+++ export PLUGIN_IMAGE=mysql
+++ PLUGIN_IMAGE=mysql
+++ export PLUGIN_IMAGE_VERSION=5.7.12
+++ PLUGIN_IMAGE_VERSION=5.7.12
+++ export PLUGIN_SCHEME=mysql
+++ PLUGIN_SCHEME=mysql
+++ export PLUGIN_SERVICE=MySQL
+++ PLUGIN_SERVICE=MySQL
+++ export PLUGIN_VARIABLE=MYSQL
+++ PLUGIN_VARIABLE=MYSQL
+++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins
+++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins
+++ [[ -n 1 ]]
+++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
+++ [[ -d /var/lib/dokku/services/mysql/* ]]
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++++ dirname /var/lib/dokku/plugins/enabled/mysql/functions
+++ cd /var/lib/dokku/plugins/enabled/mysql
+++ pwd
++ source /var/lib/dokku/plugins/enabled/mysql/common-functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
++ source /var/lib/dokku/plugins/enabled/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++ [[ -f /var/lib/dokku/plugins/available/docker-options/functions ]]
++ source /var/lib/dokku/plugins/available/docker-options/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ AVAILABLE_PHASES=(build deploy run)
+ service-create-cmd mysql:create lolipop
+ declare 'desc=create a MySQL service'
+ argv=("$@")
+ local cmd=mysql:create argv
+ [[ mysql:create == \m\y\s\q\l\:\c\r\e\a\t\e ]]
+ shift 1
+ declare SERVICE=lolipop CREATE_FLAGS_LIST=
+ service_create lolipop
+ local SERVICE=lolipop
+ [[ -z lolipop ]]
+ [[ ! -d /var/lib/dokku/services/mysql/lolipop ]]
+ SERVICE_ROOT=/var/lib/dokku/services/mysql/lolipop
+ LINKS_FILE=/var/lib/dokku/services/mysql/lolipop/LINKS
+ service_parse_args
+ declare 'desc=cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ OPTIND=1
+ getopts a:c:C:d:i:I:m:p:q:r:u: opt
+ shift 0
+ grep -q ' 5.7.12 '
+ grep -e '^mysql '
+ docker images
+ mkdir -p /var/lib/dokku/services/mysql/lolipop
+ mkdir -p /var/lib/dokku/services/mysql/lolipop/data
+ mkdir -p /var/lib/dokku/services/mysql/lolipop/config
+ touch /var/lib/dokku/services/mysql/lolipop/LINKS
+ echo -e '[mysqld]\nperformance_schema = 0'
+ echo -e '[mysqld]\ncharacter-set-server = utf8\ncollation-server = utf8_general_ci'
++ openssl rand -hex 8
+ ROOTPASSWORD=9f7a9106ae9fde3c
++ openssl rand -hex 8
+ PASSWORD=b48042c6bfa0bb17
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo 9f7a9106ae9fde3c
+ echo b48042c6bfa0bb17
+ chmod 640 /var/lib/dokku/services/mysql/lolipop/ROOTPASSWORD /var/lib/dokku/services/mysql/lolipop/PASSWORD
+ [[ -n '' ]]
+ [[ -n '' ]]
+ echo ''
+ service_create_container lolipop
+ local SERVICE=lolipop
+ local SERVICE_ROOT=/var/lib/dokku/services/mysql/lolipop
++ get_service_name lolipop
++ declare 'desc=Retrieves a docker service label'
++ declare SERVICE=lolipop
++ echo dokku.mysql.lolipop
+ local SERVICE_NAME=dokku.mysql.lolipop
++ cat /var/lib/dokku/services/mysql/lolipop/ROOTPASSWORD
+ local ROOTPASSWORD=9f7a9106ae9fde3c
++ cat /var/lib/dokku/services/mysql/lolipop/PASSWORD
+ local PASSWORD=b48042c6bfa0bb17
++ docker run --name dokku.mysql.lolipop -v /var/lib/dokku/services/mysql/lolipop/data:/var/lib/mysql -v /var/lib/dokku/services/mysql/lolipop/config:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=9f7a9106ae9fde3c -e MYSQL_USER=mysql -e MYSQL_PASSWORD=b48042c6bfa0bb17 -e MYSQL_DATABASE=lolipop --env-file=/var/lib/dokku/services/mysql/lolipop/ENV -d --restart always --label dokku=service --label dokku.service=mysql mysql:5.7.12
+ ID=b44e3ac7345da6cc2e479f4655b78a9d5d1abfea69e03e5249fdc33122aed421
+ echo b44e3ac7345da6cc2e479f4655b78a9d5d1abfea69e03e5249fdc33122aed421
+ dokku_log_verbose_quiet 'Waiting for container to be ready'
+ declare 'desc=log verbose formatter (with quiet option)'
+ [[ -z '' ]]
+ echo '       Waiting for container to be ready'
       Waiting for container to be ready
+ docker run --rm --link dokku.mysql.lolipop:mysql dokkupaas/wait:0.2 -p 3306
  ERROR: unable to connect

cannot connect to mysql

any idea what I'm doing wrong?

this is a fresh installation of dokku (0.3.26) with the latest commit from dokku-mysql.

vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku mysql:create test
-----> Starting container
       Waiting for container to be ready
=====> MySQL container created: test
       DSN: mysql://mysql:[email protected]:3306/test
vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku mysql:connect test
ERROR 1045 (28000): Access denied for user 'mysql'@'172.17.42.1' (using password: YES)

linked app doesn't display configs

When I try to inspect the linked variables for the mysql plugin I get an empty response. Is this expected?

dokku (0.3.26), latest version of dokku-mysql

vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku mysql:create test
-----> Starting container
       Waiting for container to be ready
=====> MySQL container created: test
       DSN: mysql://mysql:[email protected]:3306/test
vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku mysql:list
-----> MySQL services:
       test (running)
vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku mysql:link test nodejs-js-app
-----> Restarting app nodejs-js-app
-----> Releasing nodejs-js-app ...
-----> Deploying nodejs-js-app ...
-----> DOKKU_SCALE file found
=====> web=1
-----> Running pre-flight checks
-----> Attempt 1/6 Waiting for 5 seconds ...
       CHECKS expected result:
       http://localhost/ => ""
-----> All checks successful!
=====> nodejs-js-app container output:
       Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
       Recommending WEB_CONCURRENCY=1
=====> end nodejs-js-app container output
-----> Running post-deploy
-----> Configuring nodejs-js-app.uasabiapp.dev...
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
       Reloading nginx
-----> Shutting down old containers in 60 seconds
=====> 14bf420dfde97090f48075e52efa8c1d545018c3fc22183e9db3cf27411c5ad9
=====> Application deployed:
       http://nodejs-js-app.uasabiapp.dev
vagrant@vagrant-ubuntu-trusty-64:/vagrant_data$ dokku config nodejs-js-app
no config vars for nodejs-js-app

How do I upload my .sql file so I can import it?

I did a search and didn't' find any examples of how to migrate from another mysql database on a different server.

How do I get my upload my .sql file and reference it with the import command?

Thansk!

Custom config not being loaded - MySQL 5.7.4

Cannot load custom config variables in MySQL 5.7.4.

Steps to reproduce:

export MYSQL_IMAGE_VERSION="5.7.4"
dokku mysql:create test_db
dokku mysql:connect test_db
SHOW VARIABLES LIKE 'PERFORMANCE_SCHEMA';

This should output "performance_schema OFF", because by default, we have this file /var/lib/dokku/services/mysql/test_db/config/disable_performance_schema.cnf containing:

[mysqld]
performance_schema = 0

Any ideas?

This is not an issue with MySQL 5.5.57 for example, but unfortunately I have to use 5.7.4 specifically!

Dokku version 0.10.5

gof3r error: 307: "Please re-send this request to the specified temporary endpoint."

my-user@ubuntu:~$ dokku mysql:backup-auth my-dokku [MY_ID] [MY_SECRET]
my-user@ubuntu:~$ dokku mysql:backup my-dokku [MY_BUCKET]
Warning: Using a password on the command line interface can be insecure.
    /bin/tar: Removing leading `/' from member names
gof3r error: 307: "Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests."
/bin/tar: -: Wrote only 8192 of 10240 bytes
/bin/tar: Child returned status 141
/bin/tar: Error is not recoverable: exiting now

One of my inline policies:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1234567",
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::[MY_BUCKET]/*"
            ]
        }
    ]
}

mysql:backup produces "repository name must be lowercase

Hi 👋

I currently have an issue where calls to dokku mysql:backup produced the following error:

root@applypixels:~# dokku mysql:backup applypixels applypixels-db-backup
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
root@applypixels:~#

I've also tried to remove the - from the bucket name.
I am on dokku 0.12.13 and dokku-mysql 1.4.9

Add a `mysql:login` command

Would you accept a PR for a mysql:login command to start an interactive session with a database?

For example:

dokku mysql:login lolipop

For the purpose of running ad-hoc SQL queries in the lolipop database.

I created this command for myself as a convenience, you can see my implementation here.

Any/all feedback welcome!

mysql:import failed

I've created a new mysql service and want to init it with mysql scripts. But when I run the following:

dokku mysql:import xxxx < create.sql

The content of create.sql is:

DROP DATABASE IF EXISTS `swenet`;
CREATE DATABASE `swenet`;
ALTER SCHEMA `swenet` DEFAULT CHARACTER SET utf8;

USE swenet;

I got ERROR 1044 (42000) at line 1: Access denied for user 'mysql'@'%' to database

Backup all databases instead of the one which is called like the service

I'm having the problem that the service which uses my mysql service uses the root user and creates new databases on demand.

When I schedule an automatic backup of the mysql service (or just run mysql:export, comes down to the same command) this only exports the database which is called like the service.

But I want to backup all my databases, or specify which databases I want to backup.

I think it would be easier to backup everything by changing the mysqldump command to use the root user and the --all-databases flag here:

docker exec "$SERVICE_NAME" mysqldump --defaults-extra-file=/root/credentials.cnf --user=mysql "$SERVICE"

Error when trying to schedule backups

Hi!

I'm getting the following error when trying to schedule a backup for every night at 2am using the following command:

$ ssh dokku mysql:backup-schedule testservice "0 2 * * *" testservice-bucket-backups
Invalid flag provided, only '--use-iam' allowed

Am I doing something wrong? I can successfully trigger backups manually:

$ ssh dokku mysql:backup testservice testservice-bucket-backups
2018-08-17-09-48-21: The backup for mysql-testservice finished successfully.

Thanks for your help!

Connecting to MySQL in Sails.js app

Hi,

I'm having trouble trying to connect to MySQL in my Sails.js app.

The error I keep getting when I try to create a record is

{
  "error": "E_UNKNOWN",
  "status": 500,
  "summary": "Encountered an unexpected error",
  "raw": {}
}

I've set adapter config in /config/connections.js

mysql: {
    adapter: 'sails-mysql',
    host: 'dokku-mysql-webscraper',
    port: 3306,
    user: 'mysql',
    password: 'xxxx',
    database: 'xxxx'
  },

and specified the adapter as the default for all models, ie. in /config/development.js

models: {
    connection: 'mysql'
}

When I ssh into the box, I can access the mysql service find with dokku mysql:connect webscraper

I've tried to inspect the tables with show tables but mysql then just returns a blank prompt. Same if i try show databases.

Any ideas?!
I'm all out

Disable import on production container

Would there be a possibility to disable certain commands on certain containers? I would use this to disable importing into the production container.

Or would there already be a way to disable this?

Using dash in database names in older MySQL versions

I need to use MySQL 5.6.20 for various reasons and the following happens when I create the container:

# export MYSQL_IMAGE_VERSION='5.6.20'; dokku mysql:create slot-2-backend
-----> Starting container
       Waiting for container to be ready
=====> MySQL container created: slot-2-backend
       DSN: mysql://mysql:3317e6732f3f67dd@dokku-mysql-slot-2-backend:3306/slot-2-backend
root@ip-172-31-31-212:/var/log/upstart# dokku mysql:connect slot-2-backend
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: YES)

When I create a container without the dash, I can access it without any problem.

The reason is that text before dash is eaten, as you could see below:

mysql> create database slot-2-backend;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2-backend' at line 1

Using the backticks, it works fine:

mysql> create database `slot-2-backend`;
Query OK, 1 row affected (0.00 sec)

Kinda edge-case, although since the fix I'll propose is super simple and doesn't break anything, I thought it would worth to add it to upstream ;)

disable performance schema

Hi,

Would be nice to disable performance schema in my.cnf (performance_schema = 0) to significantly reduce memory consumption. The mysql default of 1 is probably useless in dokku environment.

Connect to mysql service from remote

Hi,

I'm running Dokku on a Amazon EC2 instance, with this plugin installed. Everything works fine, my Dokku app can get data from the Dokku MySql database.

Now I want to do a remote connection to the MySql database from my Mac, so I did:
$ mysql:expose <name> [port]

After execute this command I can see the exposed port:
Exposed ports: 3306->30412

When I tried to connect from my computer I got the following message:

mysql-js> \c <user>@<hostname>:30412
Creating a Session to '<user>@<hostname>:30412'
Enter password:
ERROR: 2003 (HY000): Can't connect to MySQL server on '<hostname>' (61)

I thought this error could be related with Amazaon, so I opened the port 30412 in the EC2 instance (Security Groups -> Inbound)...

But when I tried againt to connect I got the same message... Where is my mistake?
How can connect to the MySql service from remote?

Thanks.
Ricardo

mysql-backup only works if loose IAM access is granted

In order for the backup feature to work, I must set the IAM policy in S3 to allow access to all buckets:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1479555970000",
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        }
    ]
}

by doing the following...

            "Resource": [
                "arn:aws:s3:::<my-bucket-name>"
            ]

...backup does not work. Thrown error is the following:

me@DokkuVM:~$ dokku mysql:backup my-blog dokku-mysql-myblog-backups
mysqldump: [Warning] Using a password on the command line interface can be insecure.
                                                                                    /bin/tar: Removing leading `/' from member names
gof3r error: 403: "Access Denied"
/bin/tar: -: Wrote only 6144 of 10240 bytes
/bin/tar: Child returned status 141
/bin/tar: Error is not recoverable: exiting now

It would be great if you could make the backup feature work with tighter S3 permissions. I'd love to contribute but that would be too brave from my end. In any case, my appreciations for your work.

Can't remote connect to Mysql and MongoDB services in DOKKU

Hi,

I have dokku installed on my machine with multi apps running and some services : MongoDB and MySQL.

I used :

dokku mongo:expose my_database
dokku mysql:expose my_database

But i cant connect with Datagrip or Robomongo tools with remote connection.

I also used the information given by :

dokku mongo:info my_database
dokku mysql:info my_database

Same with the terminal to access MySQL :

mysql -u mysql -h dokku-mysql-upload --port <exposed_port> -p

I realy don't understand where is the problem.

Thank's,
Antoine

Specified 'mysql' for database adapter

I'm getting the following error message:

Specified 'mysql' for database adapter, but the gem is not loaded. Add `gem 'mysql'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

I'm under the impression dokku will ignore database.yml and use it's configurations specified over the commandline, so I can't just switch the adaptor to mysql2. I'm reading that the mysql adaptor only has strings and integers whereas the mysql2 adaptor is production ready. Is there a way to use mysql2 at this time?

plugin doesn't start at boot

When I rebooted the VM I noticed that one of my app didn't start.

After further investigation I noticed that the app can't start if all the linked containers aren't running as well.

And for some reason the mysql container wasn't running after I rebooted.

Is there any work around for this?

Connection refused with Python and Peewee

Please,

My MySQL database work and I can access externally but my Python app (with Peewee ORM) don't work. For me his return a error "Connection refused" but I did set the parameter of the DATABASE_URL with the address generated by Dokku.

I executed dokku mysql:link and doens't worked.
What can cause the error?

peewee.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")

Thanks!

Can't stop container: "No such container"

I am trying to get connected to my database but am getting the following error:

"Lost connection to MySQL server at 'reading initial communication packet, system error: 0"

I ssh'd into my vm to try to restart the dokku container but I am getting the following:

root@vultr:~# dokku mysql:list
     NAME      VERSION       STATUS   EXPOSED PORTS  LINKS
     cigarbar  mysql:5.7.12  running  3306->13409    -
root@vultr:~# dokku mysql:stop cigarbar
     -----> Stopping container
     Error response from daemon: No such container: dokku.mysql.cigarbar.ambassador

How to access as root or admin user?

Hi, i are using a separate application with phpmyadmin to access to the database by
using the same string connection. But i don't have admin rights by using the "mysql" named
user.

There is any way to get the root user to the mysql database instance?

Mysql 8

Hi
When we can have mysql 8?

MySql container stuck at "Restarting..."

Is there a way to dump the database from this container?

root@enjambreDokku:~# dokku mysql:list
NAME                                  VERSION       STATUS      EXPOSED PORTS  LINKS
base_de_datos_de_prueba_BORRAR_LUEGO  mysql:5.7.10  running     -              -
blog-db                               mysql:5.7.10  running     -              blog 
PRUEBA_COPIA_SERGIO_DB                mysql:5.7.10  running     -              -
sergio_db                             mysql:5.7.10  restarting  -              sergiodenis 
root@enjambreDokku:~# dokku mysql:stop
Please specify a name for the service
root@enjambreDokku:~# dokku mysql:stop sergio_db
 !     Service is already stopped
root@enjambreDokku:~# dokku mysql:list
NAME                                  VERSION       STATUS      EXPOSED PORTS  LINKS
base_de_datos_de_prueba_BORRAR_LUEGO  mysql:5.7.10  running     -              -
blog-db                               mysql:5.7.10  running     -              blog 
PRUEBA_COPIA_SERGIO_DB                mysql:5.7.10  running     -              -
sergio_db                             mysql:5.7.10  restarting  -              sergiodenis 
root@enjambreDokku:~# dokku mysql:logs sergio_db
2017-01-06T14:15:15.537552Z 0 [Note] InnoDB: Uses event mutexes
2017-01-06T14:15:15.537588Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-01-06T14:15:15.537691Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-01-06T14:15:15.537769Z 0 [Note] InnoDB: Using Linux native AIO
2017-01-06T14:15:15.538922Z 0 [Note] InnoDB: Number of pools: 1
2017-01-06T14:15:15.539558Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-01-06T14:15:15.576262Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-01-06T14:15:15.601823Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-01-06T14:15:15.608835Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-01-06T14:15:15.633792Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-01-06T14:15:15.636326Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 13071352515
2017-01-06T14:15:15.640499Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 13071654780
2017-01-06T14:15:15.641442Z 0 [Note] InnoDB: Database was not shutdown normally!
2017-01-06T14:15:15.641483Z 0 [Note] InnoDB: Starting crash recovery.
2017-01-06T14:15:15.669733Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
2017-01-06T14:15:15.699434Z 0 [Note] InnoDB: Apply batch completed
2017-01-06T14:15:15.843372Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-01-06T14:15:15.843530Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-01-06T14:15:15.843967Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-01-06T14:15:15.909421Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-01-06T14:15:15.912028Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-01-06T14:15:15.912132Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-01-06T14:15:15.913210Z 0 [Note] InnoDB: Waiting for purge to start
2017-01-06T14:15:15.963423Z 0 [Note] InnoDB: 5.7.10 started; log sequence number 13071654780
2017-01-06T14:15:15.964485Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-01-06T14:15:15.968656Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-06T14:15:15.973683Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2017-01-06T14:15:15.970790Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2017-01-06T14:15:15.969707Z 0 [Note] InnoDB: not started
2017-01-06T14:15:15.977670Z 0 [Note] IPv6 is available.
2017-01-06T14:15:15.977778Z 0 [Note]   - '::' resolves to '::';
2017-01-06T14:15:15.977854Z 0 [Note] Server socket created on IP: '::'.
2017-01-06T14:15:15.983775Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-01-06T14:15:15.989762Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-01-06T14:15:16.015452Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170106 14:15:16
2017-01-06T14:15:16.026585Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
InnoDB: Dump of the tablespace extent descriptor:  len 40; hex 00000000000000020000000002060000000000c600000004feffffffffafeaffffffffffffffffff; asc                                         ;2017-01-06T14:15:16.063797Z 0 [ERROR] InnoDB: InnoDB is trying to free page [page id: space=51, page number=193] though it is already marked as free in the tablespace! The tablespace free space info is corrupt. You may need to dump your tables and recreate the whole database!
2017-01-06T14:15:16.063891Z 0 [ERROR] [FATAL] InnoDB: Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
2017-01-06 14:15:16 0x7f3dad056700  InnoDB: Assertion failure in thread 139902872545024 in file ut0ut.cc line 923
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
14:15:16 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68185 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x363ff00
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f3dad055e18 thread_stack 0x40000
mysqld(my_print_stacktrace+0x2c)[0xe4258c]
mysqld(handle_fatal_signal+0x459)[0x782219]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0)[0x7f3dd79178d0]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7f3dd6105147]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f3dd6106528]
mysqld[0x7589b1]
mysqld(_ZN2ib5fatalD1Ev+0x15d)[0x107cc0d]
mysqld[0x113fc07]
mysqld(_Z14fseg_free_pagePhmmbP5mtr_t+0x1f3)[0x1141023]
mysqld(_Z32btr_free_externally_stored_fieldP12dict_index_tPhPKhPKmP14page_zip_des_tmbP5mtr_t+0x53b)[0x109d9fb]
2017-01-06T14:15:16.079664Z 0 [Note] Event Scheduler: Loaded 0 events
mysqld(_Z26btr_cur_pessimistic_deleteP7dberr_tmP9btr_cur_tmbP5mtr_t+0x5da)[0x109e14a]
mysqld[0xfec333]
mysqld(_Z14row_purge_stepP9que_thr_t+0x5a1)[0xfee001]
2017-01-06T14:15:16.083745Z 0 [Note] mysqld: ready for connections.
Version: '5.7.10'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
mysqld(_Z15que_run_threadsP9que_thr_t+0xa1c)[0xf9ca2c]
mysqld(_Z9trx_purgemmb+0xa1b)[0x104600b]
mysqld(srv_purge_coordinator_thread+0x3d6)[0x10206f6]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4)[0x7f3dd79100a4]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f3dd61b89cd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 0
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

Installed plugins:

root@enjambreDokku:~# dokku plugin
plugn: dev
  00_dokku-standard    0.5.3 enabled    dokku core standard plugin
  20_events            0.5.3 enabled    dokku core events logging plugin
  apps                 0.5.3 enabled    dokku core apps plugin
  build-env            0.5.3 enabled    dokku core build-env plugin
  certs                0.5.3 enabled    dokku core certificate management plugin
  checks               0.5.3 enabled    dokku core checks plugin
  common               0.5.3 enabled    dokku core common plugin
  config               0.5.3 enabled    dokku core config plugin
  docker-options       0.5.3 enabled    dokku core docker-options plugin
  domains              0.5.3 enabled    dokku core domains plugin
  enter                0.5.3 enabled    dokku core enter plugin
  git                  0.5.3 enabled    dokku core git plugin
  logs                 0.5.3 enabled    dokku core logs plugin
  mysql                1.0.0 enabled    dokku mysql service plugin
  named-containers     0.5.3 enabled    dokku core named containers plugin
  nginx-vhosts         0.5.3 enabled    dokku core nginx-vhosts plugin
  plugin               0.5.3 enabled    dokku core plugin plugin
  postgres             1.0.0 enabled    dokku postgres service plugin
  proxy                0.5.3 enabled    dokku core proxy plugin
  ps                   0.5.3 enabled    dokku core ps plugin
  shell                0.5.3 enabled    dokku core shell plugin
  storage              0.5.3 enabled    dokku core storage plugin
  tags                 0.5.3 enabled    dokku core tags plugin
  tar                  0.5.3 enabled    dokku core tar plugin

1.0 release

This plugin should be considered as ready for a 1.0 release.

Plugin.toml issue

Hi guys,

I'm running Dokku 0.4.0 and installed dokku-mysql.

Things are working but I keep seeing this error.
open /var/lib/dokku/plugins/available/mysql-plugin/plugin.toml: no such file or directory

Any ideas?

Thanks

How to reset an expired password

Hi, today i restart the digitalocean machine and then i see some apps having problems with de mysql container. I think this is releated to an expired password, i can't export the database content neither:

root@enjambreDokku:~# dokku mysql:export blog-db
mysqldump: [Warning] Using a password on the command line interface can be insecure.
                                                                                    mysqldump: Got error: 1862: Your password has expired. To log in you must change it using a client that supports expired passwords. when trying to connect
                                                                                       root@enjambreDokku:~#

Any advice?

MySQL container is hit or miss on creation

I know your documentation says you support 1.8 but it appears the postgres dokku plugin works but the mysql one does not for some reason. A popular webhost DigitalOcean defaults to 1.9 so maybe the plugin should support it now. On digital ocean I create the default dokku application which is Unbuntu 14.04. Dokku 0.4.4, Docker 1.9.0.
It never gets past where it says waiting on the container
root@Events:~# dokku mysql:create events
-----> Starting container
Waiting for container to be ready

I found that sometimes it creates the container correctly but most of the time it does not. This command must not be creating the container all of time it seems
docker run --name dokku.mysql.events28 -v /var/lib/dokku/services/mysql/events28/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=AAA -e MYSQL_USER=mysql -e MYSQL_PASSWORD=AAA -e MYSQL_DATABASE=events28 --env-file=/var/lib/dokku/services/mysql/events28/ENV -d --restart always --label dokku=service --label dokku.service=mysql mysql:5.6.26

access denied error

DOKKU 0.5.6

Initializing database
2016-05-09T21:02:04.361852Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-05-09T21:02:04.483236Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-05-09T21:02:04.493848Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 485d8813-1629-11e6-9744-0242ac110002.
2016-05-09T21:02:04.494722Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-05-09T21:02:04.496127Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2016-05-09T21:02:04.912199Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:04.912236Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:04.912336Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:04.912397Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:04.912484Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
Database initialized
MySQL init process in progress...
2016-05-09T21:02:06.585062Z 0 [Note] mysqld (mysqld 5.7.12) starting as process 38 ...
2016-05-09T21:02:06.590233Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-05-09T21:02:06.590518Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-09T21:02:06.590569Z 0 [Note] InnoDB: Uses event mutexes
2016-05-09T21:02:06.590610Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-05-09T21:02:06.590653Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-09T21:02:06.590691Z 0 [Note] InnoDB: Using Linux native AIO
2016-05-09T21:02:06.590773Z 0 [Note] InnoDB: Number of pools: 1
2016-05-09T21:02:06.590842Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-05-09T21:02:06.601247Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-05-09T21:02:06.610374Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-05-09T21:02:06.613475Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-05-09T21:02:06.625589Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-05-09T21:02:06.634746Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-05-09T21:02:06.634969Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-05-09T21:02:06.654631Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-05-09T21:02:06.655549Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-05-09T21:02:06.655664Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-05-09T21:02:06.656989Z 0 [Note] InnoDB: Waiting for purge to start
2016-05-09T21:02:06.707558Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 2522067
2016-05-09T21:02:06.708125Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-05-09T21:02:06.710698Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-05-09T21:02:06.711274Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-05-09T21:02:06.714615Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:06.714845Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:06.714918Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:06.714970Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:06.716883Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:06.717733Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160509 21:02:06
2016-05-09T21:02:06.723345Z 0 [Note] Event Scheduler: Loaded 0 events
2016-05-09T21:02:06.723647Z 0 [Note] mysqld: ready for connections.
Version: '5.7.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
Warning: Unable to load '/usr/share/zoneinfo/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/posix/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/right/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
2016-05-09T21:02:10.154306Z 4 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:10.154504Z 4 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:10.154598Z 4 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'avamysql``' at line 1
2016-05-09T21:02:10.624551Z 0 [Note] mysqld (mysqld 5.7.12) starting as process 1 ...
2016-05-09T21:02:10.629581Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-05-09T21:02:10.629911Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-09T21:02:10.629964Z 0 [Note] InnoDB: Uses event mutexes
2016-05-09T21:02:10.630008Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-05-09T21:02:10.630054Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-09T21:02:10.630095Z 0 [Note] InnoDB: Using Linux native AIO
2016-05-09T21:02:10.630297Z 0 [Note] InnoDB: Number of pools: 1
2016-05-09T21:02:10.630297Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-05-09T21:02:10.640978Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-05-09T21:02:10.650045Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-05-09T21:02:10.652545Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-05-09T21:02:10.665198Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-05-09T21:02:10.667183Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2522067
2016-05-09T21:02:10.890870Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 7698944
2016-05-09T21:02:11.088017Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12127344
2016-05-09T21:02:11.090228Z 0 [Note] InnoDB: Database was not shutdown normally!
2016-05-09T21:02:11.090453Z 0 [Note] InnoDB: Starting crash recovery.
2016-05-09T21:02:11.097769Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2016-05-09T21:02:11.955771Z 0 [Note] InnoDB: Apply batch completed
2016-05-09T21:02:12.060304Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2016-05-09T21:02:12.060305Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-05-09T21:02:12.060392Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-05-09T21:02:12.149851Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-05-09T21:02:12.151324Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-05-09T21:02:12.151457Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-05-09T21:02:12.156403Z 0 [Note] InnoDB: Waiting for purge to start
2016-05-09T21:02:12.207879Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 12127344
2016-05-09T21:02:12.216117Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-05-09T21:02:12.219616Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-05-09T21:02:12.233250Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160509 21:02:12
2016-05-09T21:02:12.233653Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-05-09T21:02:12.233724Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-05-09T21:02:12.233815Z 0 [Note] IPv6 is available.
2016-05-09T21:02:12.233864Z 0 [Note]   - '::' resolves to '::';
2016-05-09T21:02:12.233877Z 0 [Note] Server socket created on IP: '::'.
2016-05-09T21:02:12.237123Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:12.237293Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:12.239638Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2016-05-09T21:02:12.246416Z 0 [Note] Event Scheduler: Loaded 0 events
2016-05-09T21:02:12.246725Z 0 [Note] mysqld: ready for connections.
Version: '5.7.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
2016-05-09T21:06:49.634819Z 3 [Note] Access denied for user 'mysql'@'localhost' (using password: YES)

Access denied for user 'mysql' when connecting from app

Hi,

I'm new to dokku and I'm trying to setup my first app but I keep on getting this error when setting up mysql.

2017-03-07T18:31:02.601454732Z app[web.1]: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'mysql'@'%' to database 're_data:3306'

dokku mysql:connect re_data this command works, but my app keeps on throwing the error. The code base is already running on heroku and when I switch the url to Amazon RDS app starts working.

On mysql I can see that host has a "wildcard" (%)

mysql> SHOW GRANTS FOR 'mysql'@'%';
+-------------------------------------------------------+
| Grants for mysql@%                                    |
+-------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mysql'@'%'                     |
| GRANT ALL PRIVILEGES ON `re_data`.* TO 'mysql'@'%' |
+-------------------------------------------------------+
2 rows in set (0.00 sec)

I looked through other issues on github but still couldn't find anything that solves this error.

Am I'm missing something? I used following steps to setup the database.

dokku mysql:create re_data
dokku mysql:link re_data re-app
dokku config:set re-app  CLEARDB_DATABASE_URL='mysql://mysql:pass@dokku-mysql-re-data:3306/re_data?reconnect=true'
dokku mysql:import re_data < data-dump-2017-03-07.sql

ssh tunnel into dokku mysql container

Hiya folks! I know this should be an easy one but as far as I got was tracing through the functions file at service_link. I can't quite figure out just how the mysql container is exposing to only the host of the linked app or how I would adjust it for ssh tunneling.

Also, what exactly is the purpose of confining it to the linked app? 1 database per container per app sort of mentality?

Thanks so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.