Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql container always restarting #489

Closed
clovergne opened this issue Sep 11, 2018 · 12 comments
Closed

mysql container always restarting #489

clovergne opened this issue Sep 11, 2018 · 12 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@clovergne
Copy link

clovergne commented Sep 11, 2018

Hi,

I just tried the mysql docker image, with a docker-compose.yml file, and the mysql container is always on restart status.

Here it's the simple mysql part of the docker-compose.yml :

    db:
      image: mysql
      command: --default-authentication-plugin=mysql_native_password
      container_name: "mysqldb"
      restart: always
      environment:
        - MYSQL_ROOT_PASSWORD=root
      volumes:
              - .docker/data/db:/var/lib/mysql
      ports:
        - 3306:3306
        - 33060:33060

and here it's the logs from : docker logs --tail 5 --follow --timestamps mysqldb

2018-09-11T15:57:53.507132710Z 2018-09-11T15:57:53.505707Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2018-09-11T15:57:53.507160749Z 2018-09-11T15:57:53.505786Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.12) initializing of server in progress as process 32
2018-09-11T15:57:53.507163632Z 2018-09-11T15:57:53.506953Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2018-09-11T15:57:53.507166016Z 2018-09-11T15:57:53.506972Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-09-11T15:57:53.507823127Z 2018-09-11T15:57:53.507756Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.12)  MySQL Community Server - GPL
@wglambert wglambert added the question Usability question, not directly related to an error with the image label Sep 11, 2018
@wglambert
Copy link

Related
#290 (comment)

The Error: "initialize specified but the data directory has files in it" could happen if your system is probably out of disk space. . . .

#69 (comment)
A Windows 10 user encountering the issue had success by adding --innodb-use-native-aio=0

@LiamKarlMitchell
Copy link

LiamKarlMitchell commented Sep 13, 2018

I'm running docker toolbox to use virtual box with docker and Windows 10.

Where do I add

--innodb-use-native-aio=0

I'm just trying to start mysql/mysql-server:5.7.23

Edit: Using kitematic.. can't set command.

@clovergne
Copy link
Author

clovergne commented Sep 13, 2018

I'm an archlinux user with just docker from official repo,
The problem is still here when I do :

command: --default-authentication-plugin=mysql_native_password --innodb-use-native-aio=0

@tianon
Copy link
Member

tianon commented Sep 17, 2018

Sounds like you probably had some corruption or a botched initialization? (Did you start the image and get partway through the initialization process before it was restarted and/or killed? Have you tried wiping out the data directory and re-initializing and/or initializing a fresh new database to test?)

@clovergne
Copy link
Author

clovergne commented Sep 18, 2018

Yes, I totally destroy every container / image / volumes and rebuild everything, and also did the same in another directory to get a new data folder created :/

@tianon
Copy link
Member

tianon commented Sep 19, 2018

Can you give us an ls -a on the volume directory before and after? Can you try removing restart: always so it only runs once so you can see whether there was a more interesting failure the first time that's then cascading and getting lost in the noise of this later failure?

@clovergne
Copy link
Author

Solved : I delete my .docker/data/db : directory and rebuild everything

@tianon
Copy link
Member

tianon commented Sep 20, 2018

Cool, glad you got it figured out.

@tianon tianon closed this as completed Sep 20, 2018
@capcom923
Copy link

In windows 10, the relative directory(./xxx:/var/lib/mysql) will cause endless restarting. So, I change to use volume as below:
version: '3.4'

services:
db:
image: mysql/mysql-server:5.7
container_name: mysql
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
restart: always
ports:
- '3309:3306'
environment:
MYSQL_ROOT_PASSWORD: aaa
MYSQL_USER: a
MYSQL_PASSWORD: aaa
MYSQL_DATABASE: aaaf
volumes:
- mysqlV:/var/lib/mysql

volumes:
mysqlV:

It works fine.

@enablis
Copy link

enablis commented Dec 8, 2020

Hi,
I had the same problem when deploying a mysql instance with swarm.
for my case the container restart because the MYSQL_ROOT_PASSWORD was null.

@ghost
Copy link

ghost commented Dec 31, 2020

Hi,
i had. the same problem whit docker mysql 5.6 , only restart when executed docker-compose up , my config is

version: '3'

services:
  saesa_db:
    image: mysql:5.6
    volumes:
      - "./.mysql-data/db:/var/lib/mysql"
    restart: always
    ports:
      - 8889:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: example_db
      MYSQL_USER: root
      MYSQL_PASSWORD: root

and the error is

saesa_db_1  | InnoDB: No valid checkpoint found.
saesa_db_1  | InnoDB: If you are attempting downgrade from MySQL 5.7.9 or later,
saesa_db_1  | InnoDB: please refer to http://dev.mysql.com/doc/refman/5.6/en/upgrading-downgrading.html
saesa_db_1  | InnoDB: If this error appears when you are creating an InnoDB database,
saesa_db_1  | InnoDB: the problem may be that during an earlier attempt you managed
saesa_db_1  | InnoDB: to create the InnoDB data files, but log file creation failed.
saesa_db_1  | InnoDB: If that is the case, please refer to
saesa_db_1  | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html
saesa_db_1  | 2020-12-31 03:16:56 1 [ERROR] Plugin 'InnoDB' init function returned error.
saesa_db_1  | 2020-12-31 03:16:56 1 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
saesa_db_1  | 2020-12-31 03:16:56 1 [ERROR] Unknown/unsupported storage engine: InnoDB
saesa_db_1  | 2020-12-31 03:16:56 1 [ERROR] Aborting
saesa_db_1  |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

6 participants