Reputation: 695
I'm new to docker and I'm following this guide to setup my mac (the guide is for linux but is not the point) for a PHP dev env with docker-compose. The guide is quite good and everything seems to work correctly, there is just a part that doesn't seem to work.
If you go to Step 9 — Creating a User for MySQL, I'm running docker-compose up
and I have these errors so I can't access the db
container.
mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
db | 2020-04-16T18:22:19.603226Z 0 [ERROR] [MY-010095] [Server] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
db | 2020-04-16T18:22:19.603246Z 0 [ERROR] [MY-010119] [Server] Aborting
If I remove the - ./mysql/my.cnf:/etc/mysql/my.cnf
from the volumes everything seem to work but then for some reason my laravel
db is not created.
these command is not supposed to already create a DB?
environment:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: root
another question is where the data is stored?
db:
...
volumes:
- dbdata:/var/lib/mysql
...
#Volumes
volumes:
dbdata:
driver: local
how it works that driver local and what is the location of it?
Upvotes: 1
Views: 1554
Reputation: 1
docker-compose.yml
version: '3.7' services: db: image: mysql:8.0.21 container_name: dbweb restart: always environment: MYSQL_ROOT_PASSWORD: 'deivypassword' TZ: America/New_York ports: # : < MySQL Port running inside container> - '3306:3306' # Where our data will be persisted volumes: - dbweb2:/var/lib/mysql - ./my.cnf:/etc/mysql/my.cnf
volumes: dbweb2:
Upvotes: 0
Reputation: 695
I just found out that the tutorial uses a wrong path, the correct path is:
- ./mysql/my.cnf:/etc/my.cnf
and not:
- ./mysql/my.cnf:/etc/mysql/my.cnf
Upvotes: 2