[Support] MariaDB Official

16 posts in this topic Last Reply

Recommended Posts

Overview: Support for MariaDB Official docker container

Docker: https://hub.docker.com/_/mariadb

Github: https://github.com/MariaDB/mariadb-docker


This is the official MariaDB container which sets by default a secure random root password and the user is able to set the database name, user and password through the container's settings, which allows an easy installation.


Nextcloud Example:



Donate? 🤗


Note: You find the random root password ONLY after the first boot in the container's logs:



Link to post

Set Root Password


If you like to manually set your root password remove the word "yes" from "Generate Random Password":



Then set your password through "Show more settings":



Note: This does not allow to change the password.


Reset Root Password


Edit the container, enable advanced view and add "--skip-grant-tables" to the Post Arguments and start the container:



Now open the console of the container and execute the following commands:

mariadb -u root


SET PASSWORD FOR root@'localhost' = PASSWORD('your_new_password');




Edit the container and remove the "--skip-grant-tables" part again.

Link to post
  • 3 weeks later...
9 minutes ago, thymon said:

If I need other Database ?

You mean, if you need two databases? Then install the container twice, change the name and the paths in both containers. This would be the easiest option. For example you could name one container "nextcloud_db" and the other "npm_db" and so on.

Link to post
  • 2 weeks later...



I setup this docker container to work with NextCloud. I have been happy with the results until I updated this morning. Reviewing the logs, I see the error "Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type char(141)." After doing a little digging, I've determined I likely need to run the "mysql_upgrade" command to resolve this issue. However, I stupidly did not document the random root password generated when I originally installed the container so cannot perform any commands that require root access. Is there any way for me to recover or reset that root password? I've been researching how for hours and can't seem to find the way. Thank you in advance

Link to post



today I upgraded the MariaDB-Official Container to the latest version. I use it to run Nextcloud and Gitea but after the upgraded it I got the following error in Nextcloud (Gitea just works fine):

SQLSTATE[HY000] [2002]

php_network_getaddresses: getaddrinfo failed: Name does not resolve in /config/www/nextcloud/lib/private/DB/Connection.php:85


I changed nothing in my Nextcloud configuration. I connect to the database by using the hostname of the MariaDB-Official container (what still works fine with Gitea).

Both containers are in the same docker network. I already tried to give the MaraiDB-Official container a static IP address in the docker network and connect Nextcloud by this address but this didn't work.


Meanwhile I rolled back to MariaDB-Official 10.5.11 and it works fine at the moment.


What can I do? I'm a little bit overloaded with this problem because I do not know what else to do.


Many thanks in advance.

Link to post
On 7/15/2021 at 10:52 AM, SynIQ said:

a static IP address in the docker network and connect Nextcloud by this address but this didn't work.

And which error was returned after you used the IP instead? Because "Name does not resolve" is a really clear error message. But it's strange that it happens only with the new version of the container.


On 7/15/2021 at 10:52 AM, SynIQ said:

What can I do?


Stop Nextcloud and Gitea. Stop MariaDB. Execute this, to copy the container files:

mkdir /mnt/user/appdata/MariaDB-Copy
cp -a /mnt/user/appdata/MariaDB-Official /mnt/user/appdata/MariaDB-Copy


Rename MariaDB to "MariaDB-Live" or whatever. By renaming the container it becomes available for a second installation:



Install the container a second time and name it "MariaDB-Copy" and change all paths (!):



Now you have a container copy to play with. Upgrade it.


Open the Nextcloud console and use "curl name:3306" or "curl ip:3306" to check the connection to this db container. What are the results? And what are the logs of the upgraded mariadb container?

Link to post

Hi and thanks for your answer. 


I tried it over the ip address but I still got the same error:


2021/07/15 10:05:41 [error] 414#414: *51529 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve in /config/www/nextcloud/lib/private/DB/Connection.php:85
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1486): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1014): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /config/www/nextcloud/lib/private/DB/Connection.php(226): Doctrine\DBAL\Connection->executeQuery()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(210): OC\DB\Connection->executeQuery()
#4 /config/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /config/www/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /config/www/nextcloud/lib/private/AppConfig.php(1" while reading response header from upstream, client: <Client-IP>, server: _, request: "PROPFIND /remote.php/dav/files/<username>/ HTTP/1.1", upstream: "fastcgi://", host: "<Host-IP>"


I also tried your suggestion but with no success. I got the following error with both, the hostname and the ip address. 




After I ran the command the logs of MariaDB say the following but the same error appears when I run the command from Nextcloud container to the older working MariaDB container.


2021-07-17 20:00:04 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'unauthenticated' host: '' (This connection closed normally without authentication)


This means that the Nextcloud container can reach the MariaDB container although the errormessage says that Nextcloud can't resolve the hostname?When I try to make an action on the webinterface of nextcloud connected to the latest container of MariaDB the error appears and there is no new record in the log of MariaDB. Thats so confusing... I've never had somthing like this bevor.


I tried the same command from another container (phpMyAdmin) and there the command has apparently been successful. 



They are all in the same docker network. 


Edited by SynIQ
Link to post
1 hour ago, SynIQ said:

Thats confusing...

For me, too. I installed Nextcloud and MariaDB to test your situation, but I have no problems to connect the DB:



It even works in a custom network created as follows:

docker network create --subnet= nextcloud



The alias, too (not sure why those "Expires" appear, but the connection itself is possible):



Your updated container runs with MariaDB 10.6.3-focal?


Link to post

Thank you very much for testing it again.


Until now I used the "latest" tag but I tried the "focal" tag and it didn't work for now.


Since there seems to be no fundamental problem I will keep trying to get it work for me. Now it looks like the problem is nextcloud itself.

If I may find the problem I will report it here. 


Thank you very very much for your Help :) 

Link to post
24 minutes ago, SynIQ said:

Thank you very much for testing it again.

No problem. Maybe you try the following:


Export all databases as sql file:

docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql


Now remove your MariaDB Offical Docker and rename the container's files:

mv /mnt/user/appdata/MariaDB-Official /mnt/user/appdata/MariaDB-Official-Backup


Remove the MariaDB Template through Apps -> Previous Apps


Now re-install MariaDB Official with the recent version and import your backup:

docker exec -i MariaDB-Official sh -c 'exec mysql -uroot -p"YOUR_ROOT_PASSWORD"' < /mnt/user/Backups/all-databases.sql


Maybe this helps to solve your problem. If not, remove the container again and delete the new container files as follows:

rm -rI /mnt/user/appdata/MariaDB-Official


then rename the old files and install the container with the older working version again:

mv /mnt/user/appdata/MariaDB-Official-Backup /mnt/user/appdata/MariaDB-Official


Link to post

Now I know what's the problem here. 


I've tried this and got a new type of error.

20 hours ago, mgutt said:

Export all databases as sql file:

docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql


Now remove your MariaDB Offical Docker and rename the container's files:

mv /mnt/user/appdata/MariaDB-Official /mnt/user/appdata/MariaDB-Official-Backup


Remove the MariaDB Template through Apps -> Previous Apps


Now re-install MariaDB Official with the recent version and import your backup:

docker exec -i MariaDB-Official sh -c 'exec mysql -uroot -p"YOUR_ROOT_PASSWORD"' < /mnt/user/Backups/all-databases.sql


While importing the file into the new container with the latest version I got this:

ERROR 4047 (HY000) at line 3357: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.


When I tried to import the same file to a new container running MariaDB 10.5.11 the import was successful.


So I startet to research a bit for this error and found some posts in the nextcloud community with similar problems in conjunction with MariaDB 10.6.3. It seems there is a problem with the compression and the charset.


The line which was referenced in the error above was the beginning of table containing the nextcloud users. Now I think the error I had (SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve in /config/www/nextcloud/lib/private/DB/Connection.php:85) referenced not the hostname of MariaDB but the name of the current user in the database table.


After setting the charset using 

docker exec -it nextcloud bash
sudo -u abc php /config/www/nextcloud/occ config:system:set mysql.utf8mb4 --type boolean --value="false"


sudo -u abc php /config/www/nextcloud/occ maintenance:repair --include-expensive


Nextcloud works with the latest image of MariaDB but warning this configuration may cause issues with 4-byte characters like emojis.


Again many thanks for your help @mgutt. Without your help I probably would not have come up with a solution.

Edited by SynIQ
Link to post
  • 3 weeks later...

Could it be that the path to /etc/mysql/conf.d should be pointin to /etc/mysql/mariadb.conf.d ? Because the official mariadb image seems to work with the mariadb.conf.d and not with conf.d

At least the conf.d folder is empty in my installation.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.