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

mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied) #219

Closed
aarongeiser opened this issue Oct 5, 2016 · 7 comments

Comments

@aarongeiser
Copy link

@aarongeiser aarongeiser commented Oct 5, 2016

Hello -

I have been unable to get the MySQL container to initialize. I consistently get the above error. I have attempted to remove the .data folder and re-initialize the container. No luck.

The other two containers build and run fine. I have had the MySQL container run successfully once or twice - but only after a complete system restart. I have not been able to reproduce the successful running of the container - otherwise I wouldn't be posting this issue. ;)

Docker version 1.12.1, build 6f9534c
docker-machine version 0.8.1, build 41b3b25

[docker-compose.yml]

version: '2'

services:
    mysql:
        image: mysql:5.7.15
        ports:
            - 3306:3306
        volumes:
            - "./.data/db:/var/lib/mysql"
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    php:
        build: docker/php7-fpm
        ports:
            - 9000:9000
        links:
            - mysql:synthesizer
        volumes:
            - ${SYMFONY_APP_PATH}:/var/www/symfony
            - ./logs/symfony:/var/www/symfony/app/logs
    nginx:
        build: docker/nginx
        ports:
            - 80:80
        links:
            - php
        volumes_from:
            - php
        volumes:
            - ./logs/nginx/:/var/log/nginx

[docker logs]

mysql:5.7.15        "docker-entrypoint.sh"   14 seconds ago      Exited (1) 14 seconds ago

Initializing database
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2016-10-05T04:26:41.741277Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-05T04:26:41.749972Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2016-10-05T04:26:41.750014Z 0 [ERROR] Aborting
@yosifkit
Copy link
Member

@yosifkit yosifkit commented Oct 5, 2016

Since you seem to be running on OSX or Windows, add in a user: 1000:50. It defaults to running as the mysql user which is not able to access folders mounted from OSX/Windows.

@ikbenben
Copy link

@ikbenben ikbenben commented Nov 16, 2016

@yosifkit I'm also experiencing this issue. Where would you specify the user: 1000:50. I assumed as a child of the mysql: image definition but htis is indicating it is invalid as it should be a string

services:
  wp_db:
    user: 1000:50
    ...

This is the output I get when I try to bring it up:

MacBook-Pro:wordpress-site brooney$ docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because: services.wp_db.user contains an invalid type, it should be a string

@yosifkit
Copy link
Member

@yosifkit yosifkit commented Nov 16, 2016

@ikbenben, It just needs some quotes around it user: "1000:50".

@yosifkit
Copy link
Member

@yosifkit yosifkit commented Nov 16, 2016

This issue seems to be solved; feel free to comment if you feel it was closed in error.

@tofl
Copy link

@tofl tofl commented May 31, 2019

Hello @yosifkit, I know it's an old issue but your fix doesn't seem to work for me. It did copy everything inside my volume (on my host), but this time I get another error : 2019-05-31T18:55:22.990012Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 22 in a file operation.. Then my container stops running.

@yosifkit
Copy link
Member

@yosifkit yosifkit commented May 31, 2019

@tofl, that sounds like you might need something like MariaDB/mariadb-docker#200 (comment)

i.e. docker run -d -v /host/path/:/var/lib/mysql mysql:8.0 --innodb-flush-method=O_DSYNC

I can't remember what is required to make it work (or if it will ever work), and it depends whether you are using Docker for Mac, Docker for Windows, or Boot2Docker (via Docker Toolbox).

In the future, it'd be better to post questions like this in the Docker Community Forums, the Docker Community Slack, or Stack Overflow.

@threesquared
Copy link

@threesquared threesquared commented Apr 14, 2021

If anyone else runs into this I was having the same problem but I didn't see the lines above this error which said:

db_1         | 2021-04-14T07:15:05.694499Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
db_1         | 2021-04-14T07:15:05.694574Z 0 [ERROR] InnoDB: Write to file ./ibdata1failed at offset 0, 1048576 bytes should have been written, only 0 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
db_1         | 2021-04-14T07:15:05.694600Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
db_1         | 2021-04-14T07:15:05.694614Z 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space

I just had to increase the size of my Docker disk in OSX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants