Docker Community Forums

Share and learn in the Docker community.

MariaDB can't access folder

Currently I’m testing the official MariaDB dock https://hub.docker.com/_/mariadb/
When I use the default location for the DB everything is working fine.
Now that I’ve changed the following paths an permission error occurs;

  • /var/lib/mysql
  • /etc/mysql

Log:

  • Initializing database stdout
  • 08:53:34 2019-07-15 8:53:34 0 [Warning] Can’t create test file /var/lib/mysql/MariaDB.lower-test stdout
  • 08:53:34 a/usr/sbin/mysqld: Can’t change dir to ‘/var/lib/mysql/’ (Errcode: 13 “Permission denied”) stdout
  • 08:53:34 2019-07-15 8:53:34 0 [ERROR] Aborting

I use the correct user and group parameters;

  • PUID 1026
  • PGID 101
    and tried
  • UID 1026
  • GID 101

This user has all the permission drwxrwxrwx+

How can I fix this permission issue?

Not quite sure what you mean with ‘changed the paths’, but in general you shouldn’t change anything, but instead mount a folder or a volume into /var/lib/mysql. Read the section ‘Where to store data’ in the docs for the MariaDB image for more information.

Sorry I did mean this I use /volume1/data/mariadb for /var/lib/mysql within the dock.

If /volume1/data/mariadb is a folder on your host and you mount it into the container, then don’t do that. Use a named volume instead. I don’t know what system you use, but you can only use local folders for database libraries on Linux and even here under certain circumstances only.

Yaa agreed.Infact many people use volume1/data for mysql within the dock…And its pretty good.

I use Synology Dock and my other docks are working fine with this setup.

Screenshot%20at%20Jul%2021%2021-21-48

But the others are no database containers? A database doesn’t just write and read files, it needs a high performance access to the file system. If something is wrong here, you get error messages that are not very helpful.