title: Error: permission denied while mysql_intstall_db
body: <p>I tried to install mariadb on blank Alpine Linux 3.6 in LXC container hosted on Turris OS (OpenWrt omnia 15.05 r47055).</p>
  
  <p>Installation failed on permision denied error. I change privilegs but instalataror still failure.</p>
  
  <pre><code>root@alpinelxccontainer:~# DB_DATA_PATH="/var/lib/mysql"
  root@alpinelxccontainer:~# DB_ROOT_PASS="heslo"
  root@alpinelxccontainer:~# DB_USER="mariadb_user"
  root@alpinelxccontainer:~# DB_PASS="heslo"
  root@alpinelxccontainer:~# MAX_ALLOWED_PACKET="200M"
  
  root@alpinelxccontainer:~# mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}
  
  WARNING: The host 'alpinelxccontainer' could not be looked up with /usr/bin/resolveip.
  This probably means that your libc libraries are not 100 % compatible
  with this binary MariaDB version. The MariaDB daemon, mysqld, should work
  normally with the exception that host name resolving will not work.
  This means that you should use IP addresses instead of hostnames
  when specifying MariaDB privileges !
  Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
  2018-07-25 22:14:30 3069281488 [Note] /usr/bin/mysqld (mysqld 10.1.32-MariaDB) starting as process 1876 ...
  2018-07-25 22:14:30 3069281488 [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
  2018-07-25 22:14:30 3069281488 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
  2018-07-25 22:14:30 3069281488 [ERROR] Plugin 'Aria' init function returned error.
  2018-07-25 22:14:30 3069281488 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
  
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: Using mutexes to ref count buffer pool pages
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: The InnoDB memory heap is disabled
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: Compressed tables use zlib 1.2.11
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: Using Linux native AIO
  2018-07-25 22:14:30 3069281488 [Note] InnoDB: Using generic crc32 instructions
  2018-07-25 22:14:30 3069281488 [ERROR] mysqld: Can't create/write to file '/tmp/ibXXXXXX' (Errcode: 13 "Permission denied")
  2018-07-25 22:14:30 b6f184d0  InnoDB: Error: unable to create temporary file; errno: 13
  2018-07-25 22:14:30 3069281488 [ERROR] Plugin 'InnoDB' init function returned error.
  2018-07-25 22:14:30 3069281488 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
  2018-07-25 22:14:30 3069281488 [ERROR] Unknown/unsupported storage engine: InnoDB
  2018-07-25 22:14:30 3069281488 [ERROR] Aborting
  
  
  root@alpinelxccontainer:~# ls -la /var/lib/mysql/
  total 0
  drwxr-sr-x    1 mysql    mysql           48 Jul 25 22:14 .
  drwxr-xr-x    1 root     root            36 Jul 25 22:09 ..
  drwx------    1 mysql    mysql            0 Jul 25 22:14 mysql
  -rw-rw----    1 mysql    mysql            0 Jul 25 22:14 mysql-bin.index
  drwx------    1 mysql    mysql            0 Jul 25 22:14 test
  
  
  
  root@alpinelxccontainer:~# chmod -R 777 /var/lib/mysql/
  root@alpinelxccontainer:~# ls -la /var/lib/mysql/
  total 0
  drwxrwxrwx    1 mysql    mysql           48 Jul 25 22:14 .
  drwxr-xr-x    1 root     root            36 Jul 25 22:09 ..
  drwxrwxrwx    1 mysql    mysql            0 Jul 25 22:14 mysql
  -rwxrwxrwx    1 mysql    mysql            0 Jul 25 22:14 mysql-bin.index
  drwxrwxrwx    1 mysql    mysql            0 Jul 25 22:14 test
  
  
  root@alpinelxccontainer:~# mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}
  Still same error: [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
  </code></pre>
  
  <p>Complete dump of installation: <a href="https://gist.github.com/jakubs/24c642bc8d6779beaf1b944c6f399675" rel="nofollow noreferrer">https://gist.github.com/jakubs/24c642bc8d6779beaf1b944c6f399675</a>
  Related: installation guide: <a href="https://wiki.alpinelinux.org/wiki/MariaDB" rel="nofollow noreferrer">https://wiki.alpinelinux.org/wiki/MariaDB</a></p>