GithubHelp home page GithubHelp logo

rpi-mysql's Introduction

rpi-mysql Build Status

Raspberry Pi compatible Docker base image with MySQL. It is based on the official Mysql Docker Image ported to the ARM based Raspbery Pi.

What is MySQL?

logo

MySQL is the world's most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, Twitter, YouTube, Yahoo! and many more.

For more information and related downloads for MySQL Server and other MySQL products, please visit www.mysql.com.

Build Details

Build the Docker Image

Run all the commands from within the project root directory.

make build

Run the Docker Image and get the version of the installed mysql

make version

Push the Docker Image to the Docker Hub

  • First use a docker login with username, password and email address
  • Second push the Docker Image to the official Docker Hub
make push

How to use this image

Start a MySQL server instance

Starting a MySQL instance is simple:

docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag

... where some-mysql is the name you want to assign to your container, my-secret-pw is the password to be set for the MySQL root user and tag is the tag specifying the MySQL version you want. See the list above for relevant tags.

Connect to MySQL from an application in another Docker container

This image exposes the standard MySQL port (3306), so container linking makes the MySQL instance available to other application containers. Start your application container like this in order to link it to the MySQL container:

docker run --name some-app --link some-mysql:mysql -d app-that-uses-mysql

Connect to MySQL from the MySQL command line client

The following command starts another MySQL container instance and runs the mysql command line client against your original MySQL container, allowing you to execute SQL statements against your database instance:

docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'

... where some-mysql is the name of your original MySQL Server container.

More information about the MySQL command line client can be found in the MySQL documentation

Container shell access and viewing MySQL logs

The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your mysql container:

docker exec -it some-mysql bash

The MySQL Server log is available through Docker's container log:

docker logs some-mysql

Using a custom MySQL configuration file

The MySQL startup configuration is specified in the file /etc/mysql/my.cnf, and that file in turn includes any files found in the /etc/mysql/conf.d directory. Settings in files in this directory will augment and/or override settings in /etc/mysql/my.cnf. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as /etc/mysql/conf.d inside the mysql container.

If /my/custom/config-file is the path and name of your custom configuration file, you can start your mysql container like this (note that only the directory path of the custom config file is used in this command):

docker run --name some-mysql -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag

This will start a new container some-mysql where the MySQL instance uses the combined startup settings from /etc/mysql/my.cnf and /etc/mysql/conf.d/config-file, with settings from the latter taking precedence.

Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to your new config file so that the container will be allowed to mount it:

chcon -Rt svirt_sandbox_file_t /my/custom

Environment Variables

When you start the mysql image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the docker run command line. Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup.

MYSQL_ROOT_PASSWORD

This variable is mandatory and specifies the password that will be set for the MySQL root superuser account. In the above example, it was set to my-secret-pw.

MYSQL_DATABASE

This variable is optional and allows you to specify the name of a database to be created on image startup. If a user/password was supplied (see below) then that user will be granted superuser access (corresponding to GRANT ALL) to this database.

MYSQL_USER, MYSQL_PASSWORD

These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created.

Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the MYSQL_ROOT_PASSWORD variable.

MYSQL_ALLOW_EMPTY_PASSWORD

This is an optional variable. Set to yes to allow the container to be started with a blank password for the root user. NOTE: Setting this variable to yes is not recommended unless you really know what you are doing, since this will leave your MySQL instance completely unprotected, allowing anyone to gain complete superuser access.

Caveats

Where to Store Data

Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the mysql images to familiarize themselves with the options available, including:

  • Let Docker manage the storage of your database data by writing the database files to disk on the host system using its own internal volume management. This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers.
  • Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container. This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly.

The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above:

  1. Create a data directory on a suitable volume on your host system, e.g. /my/own/datadir.

  2. Start your mysql container like this:

    docker run --name some-mysql -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag

The -v /my/own/datadir:/var/lib/mysql part of the command mounts the /my/own/datadir directory from the underlying host system as /var/lib/mysql inside the container, where MySQL by default will write its data files.

Note that users on host systems with SELinux enabled may see issues with this. The current workaround is to assign the relevant SELinux policy type to the new data directory so that the container will be allowed to access it:

chcon -Rt svirt_sandbox_file_t /my/own/datadir

No connections until MySQL init completes

If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as docker-compose, which start several containers simultaneously.

Usage against an existing database

If you start your mysql container instance with a data directory that already contains a database (specifically, a mysql subdirectory), the $MYSQL_ROOT_PASSWORD variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way.

License

The MIT License (MIT)

Copyright (c) 2015 Hypriot

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

rpi-mysql's People

Contributors

alexander-krause-glau avatar govinda-fichtner avatar mathiasrenner avatar oguera avatar stefanscherer 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi-mysql's Issues

I receive "Exec format error"

After apt-get update, apt-get dist-upgrade of the base Hypriot System on Raspi I receive an
EXEC format error.
db_1 | standard_init_linux.go:211: exec user process caused "exec format error"

Linux OpenHAB 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Docker version 19.03.4, build 9013bf5

Add mysql 5.6

I tried to modify the Dockerfile/Makefile to support 5.6. The build was successful, but it crashes soon after it starts:

# tail /var/log/mysql/error.log
2016-04-04 04:18:49 3152 [Note] InnoDB: Completed initialization of buffer pool
2016-04-04 04:18:49 3152 [Note] InnoDB: Highest supported file format is Barracuda.
2016-04-04 04:18:49 3152 [Note] InnoDB: 128 rollback segment(s) are active.
2016-04-04 04:18:49 3152 [Note] InnoDB: Waiting for purge to start
2016-04-04 04:18:49 3152 [Note] InnoDB: 5.6.28 started; log sequence number 1600637
2016-04-04 04:18:49 3152 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2016-04-04 04:18:49 3152 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2016-04-04 04:18:49 3152 [Note] Server socket created on IP: '127.0.0.1'.
2016-04-04 04:18:49 3152 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
160404 04:18:49 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Maybe you can give it a shot. I only had to add a new apt source to get 5.6 installed:

# cat /etc/apt/sources.list
deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi firmware
deb http://http.us.debian.org/debian/ unstable non-free contrib main

Exectue sh/sql/sql.gz Files

Like the official MySQL Docker Image this Images should be able to execute Files from within /docker-entrypoint-initdb.d/*

No manifest for linux/arm64/v8

When installing this container on my raspberrypi, i get the following error:
docker: no matching manifest for linux/arm64/v8 in the manifest list entries.

uname -m gives me the following output:
aarch64

I don't know a lot about docker or linux, but is the problem that my pi is on a 64 bit OS?

Can't start when bind and NFS mouting for /var/lib/mysql container directory

Hello,

I try to setup this container on a raspberry.
On Docker host, I have mount an NFS share to /mnt/swarmData/labemilie-db and I could write on it.
I try to start a container with this command line :
docker container create --name labemilie-db --hostname labemilie-db --network labemilie-network -v /mnt/swarmData/labemilie-db:/var/lib/mysql --env MYSQL_ROOT_PASSWORD=bestPassword hypriot/rpi-mysql:arm-5.5
But I got this error :

181118 17:18:47 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.,
181118 17:18:47 [Note] mysqld (mysqld 5.5.60-0+deb7u1) starting as process 1 ...,
181118 17:18:47 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.,
181118 17:18:47 [Note] Plugin 'FEDERATED' is disabled.,
�mysqld: Can't find file: './mysql/plugin.frm' (errno: 13),
181118 17:18:47 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.,
181118 17:18:47 InnoDB: The InnoDB memory heap is disabled,
181118 17:18:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins,
181118 17:18:47 InnoDB: Compressed tables use zlib 1.2.7,
181118 17:18:47 InnoDB: Using Linux native AIO,
181118 17:18:47 InnoDB: Initializing buffer pool, size = 128.0M,
181118 17:18:47 InnoDB: Completed initialization of buffer pool,
181118 17:18:47  InnoDB: Operating system error number 13 in a file operation.,
InnoDB: The error means mysqld does not have the access rights to,
InnoDB: the directory.,
InnoDB: File name ./ibdata1,
InnoDB: File operation call: 'create'.,
InnoDB: Cannot continue operation.,

If I try to start the same container without the mounting of /var/lib/mysql, it's OK.
Could you help to solve this behaviour?

Thanks for your help.

Add MySQL 5.7

Would really love to see updated releases of this container, namely a 5.7 container.

Container not working in docker-compose with swarm

Hi there,

I use a 4 node HypriotOS cluster and have a problem running running rpi-mysql as one service in docker-compose-yml.

The error message is: no suitable node (unsupported platform on 4 nodes)

According to my understand and checks the architecture cluster is armv7l, but the image used is amd64. Here is the corresponding output:

docker info:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 18.05.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
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: active
 NodeID: v8gvd8b8mj691a60zwqamqmsz
 Is Manager: true
 ClusterID: izjv51lqodr8grt7ak1g005pd
 Managers: 1
 Nodes: 4
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: 192.168.3.1
 Manager Addresses:
  192.168.3.1:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.14.34-hypriotos-v7+
Operating System: Raspbian GNU/Linux 9 (stretch)
OSType: linux
Architecture: armv7l
CPUs: 4
Total Memory: 976.7MiB
Name: hydra
ID: 6SGF:7I46:ZZWD:AWN5:TCVS:R37F:CIK7:5JOX:ACPQ:YI5H:IYHN:KIKT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

docker service inspect openhab-suite_mysqldb:

[
    {
        "ID": "soqhiur1f612rsg7hwtf7ukw7",
        "Version": {
            "Index": 2211
        },
        "CreatedAt": "2018-06-16T01:41:43.341077286Z",
        "UpdatedAt": "2018-06-16T01:41:43.348289301Z",
        "Spec": {
            "Name": "openhab-suite_mysqldb",
            "Labels": {
                "com.docker.stack.image": "hypriot/rpi-mysql",
                "com.docker.stack.namespace": "openhab-suite"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "hypriot/rpi-mysql:latest@sha256:c1567c885cf560da66a647f91f7e16bfeea2968895f859b5732583a8db3570ea",
                    "Labels": {
                        "com.docker.stack.namespace": "openhab-suite"
                    },
                    "Env": [
                        "MYSQL_DATABASE=openhab2",
                        "MYSQL_PASSWORD=ignorethis",
                        "MYSQL_ROOT_PASSWORD=superignorethis",
                        "MYSQL_USER=someuser"
                    ],
                    "Privileges": {
                        "CredentialSpec": null,
                        "SELinuxContext": null
                    },
                    "Mounts": [
                        {
                            "Type": "bind",
                            "Source": "/swarm/volumes/mysql/",
                            "Target": "/var/lib/mysql"
                        }
                    ],
                    "StopGracePeriod": 10000000000,
                    "DNSConfig": {},
                    "Isolation": "default"
                },
                "Resources": {},
                "RestartPolicy": {
                    "Condition": "any",
                    "Delay": 5000000000,
                    "MaxAttempts": 0
                },
                "Placement": {
                    "Platforms": [
                        {
                            "Architecture": "amd64",
                            "OS": "linux"
                        }
                    ]
                },
                "Networks": [
                    {
                        "Target": "8lkdos19at3susum00dsofsbs",
                        "Aliases": [
                            "mysqldb"
                        ]
                    }
                ],
                "ForceUpdate": 0,
                "Runtime": "container"
            },
            "Mode": {
                "Replicated": {
                    "Replicas": 1
                }
            },
            "UpdateConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "RollbackConfig": {
                "Parallelism": 1,
                "FailureAction": "pause",
                "Monitor": 5000000000,
                "MaxFailureRatio": 0,
                "Order": "stop-first"
            },
            "EndpointSpec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 3306,
                        "PublishedPort": 3306,
                        "PublishMode": "ingress"
                    }
                ]
            }
        },
        "Endpoint": {
            "Spec": {
                "Mode": "vip",
                "Ports": [
                    {
                        "Protocol": "tcp",
                        "TargetPort": 3306,
                        "PublishedPort": 3306,
                        "PublishMode": "ingress"
                    }
                ]
            },
            "Ports": [
                {
                    "Protocol": "tcp",
                    "TargetPort": 3306,
                    "PublishedPort": 3306,
                    "PublishMode": "ingress"
                }
            ],
            "VirtualIPs": [
                {
                    "NetworkID": "ycxuvpuz55wn8li2g3pz7pvpy",
                    "Addr": "10.255.1.71/16"
                },
                {
                    "NetworkID": "8lkdos19at3susum00dsofsbs",
                    "Addr": "10.0.2.6/24"
                }
            ]
        }
    }
]

and last the docker-compose.yml:

version: '3'

services:
#  openhab:
#    image: "openhab/openhab:2.2.0-armhf-debian"
#    depends_on:
#      - mysqldb
#      - mosquitto
#    restart: always
#    ports:
#      - "80:8080"
#      - "443:8443"
#    volumes:
#      - /etc/localtime:/etc/localtime:ro
#      - ./timezone:/etc/timezone:ro
#      - /swarm/volumes/openhab/config:/openhab/conf
#      - /swarm/volumes/openhab/persist:/openhab/userdata/persistence
#      - /swarm/volumes/openhab/logs:/openhab/userdata/logs
#      - ./backup:/backups
#    networks:
#      - openhab_net
  mysqldb:
   image: hypriot/rpi-mysql
   volumes:
      - /swarm/volumes/mysql/:/var/lib/mysql
   ports:
      - "3306:3306"
   restart: always
   environment:
      MYSQL_ROOT_PASSWORD: "superignorethis"
      MYSQL_DATABASE: openhab2
      MYSQL_USER: someuser
      MYSQL_PASSWORD: "ignorethis"
   networks:
      - openhab_net
  mosquitto:
    image: pascaldevink/rpi-mosquitto
    restart: always
    ports:
       - "1883:1883"
       - "9001:9001"
    volumes:
       - /swarm/volumes/mqtt/config:/mqtt/config:ro
       - /swarm/volumes/mqtt/log:/mqtt/log
       - /swarm/volumes/mqtt/data:/mqtt/data
    networks:
       - openhab_net
networks:
  openhab_net:

BTW the mosquitto image works without a problem ...

armv7l binaries running on armv6l OS ?

I don't have any issue, but much more a question actually:
Is it possible to run armv7l binaries on a armv6l OS ?

Because this is what it looks like on rpi1 devices:

$ docker run -it --rm hypriot/rpi-mysql mysql --version
mysql Ver 14.14 Distrib 5.5.60, for debian-linux-gnu (armv7l) using readline 6.2

$ docker run -it --rm hypriot/rpi-mysql uname -a
Linux f2e6f925ce19 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux

Container won't start after todays changes

Hi,
it seems like after todays commits / image rebuilds the container won't start. It currently crashes with the following log:

2018-06-16 14:28:45 1995644928 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-06-16 14:28:45 1995644928 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-16 14:28:45 1995644928 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Using Linux native AIO
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Using generic crc32 instructions
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Completed initialization of buffer pool
2018-06-16 14:28:45 1995644928 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-16 14:28:46 1995644928 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-16 14:28:46 1995644928 [Note] InnoDB: Waiting for purge to start
2018-06-16 14:28:46 1995644928 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.35-80.0 started; log sequence number 30965811
2018-06-16 14:28:46 1430254400 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-06-16 14:28:46 1995644928 [Note] Plugin 'FEEDBACK' is disabled.
2018-06-16 14:28:46 1995644928 [Note] Server socket created on IP: '127.0.0.1'.
2018-06-16 14:28:46 1995644928 [ERROR] Can't start server : Bind on unix socket: No such file or directory
2018-06-16 14:28:46 1995644928 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
2018-06-16 14:28:46 1995644928 [ERROR] Aborting

I can replicate that problem on 2 different Pi's, started via docker run -ti -e MYSQL_ROOT_PASSWORD=test hypriot/rpi-mysql:latest.

Any idea on how to fix this problem?

Problem with entrypoint.sh

Whenever

  db:
    image: hypriot/rpi-mysql
    ports:
      - "32000:3306"
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=foo
      - MYSQL_DATABASE=bar
      - MYSQL_USER=demouser
      - MYSQL_PASSWORD=demopassword
    volumes:
      - ./db/schema:/docker-entrypoint-initdb.d/:ro

Inside /db/schema I have 1.sql:

USE `bar`;

CREATE TABLE `Logs` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `user_message` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `message` text COLLATE utf8_bin,
  `read` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
);

I receive the error:

ERROR: 1064 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 '' at line 1

When I use the tobi312/rpi-mysql image everything works as expected.

Inside the container when runnning:

$ cat /tmp/mysql-first-time.sql 

I get:

DELETE FROM mysql.user ;
CREATE USER 'root'@'%' IDENTIFIED BY 'demopassword' ;
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
DROP DATABASE IF EXISTS test ;
CREATE DATABASE IF NOT EXISTS `bar` ;
CREATE USER 'demouser'@'%' IDENTIFIED BY 'demopassword' ;
GRANT ALL ON `bar`.* TO 'demouser'@'%' ;
FLUSH PRIVILEGES ;
USE `bar`;

CREATE TABLE `Logs` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `user_message` varchar(50) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `message` text COLLATE utf8_bin,
  `read` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
);

Which seems to have no syntax error other than the space?

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.