Linuxserver/mariadb can not be added to grafana in docker

Dear All,
I installed in docker linuxserver/mariadb in the same docker is running grafana. The problem is that I cannot add this mariadb to grafana source databases by try I am getting error:

db query error: query failed - please inspect Grafana server log for details

After checking docker logs I am getting:

t=2021-10-28T10:22:25+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“dial tcp ?>127.0.0.1:3307: connect: connection refused”
t=2021-10-28T10:22:25+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 >uname=admin method=POST path=/api/ds/query status=400 remote_addr=192.168.100.103 >time_ms=65 size=233 referer=http://192.168.100.10:3000/datasources/edit/SmJqqnWgz

I am almost sure that the problem is related to this version of mariadb, due to the fact that if I am using other mariadb server everything is ok and source is added to grafana.
Please support me…

127.0.0.1:3307: connect: connection refused don’t use localhost and use your hostip or the container name if you’re using docker networking.

Hi,
when I am using host ip or docker container name the problem is the same, please see configuration below. The configuration of docker containers are as well presented below:

Could you post your docker-compose file too please? also any relevant information about your host os/docker version.

Thanks

Docker version:

Client: Docker Engine - Community
Version: 20.10.9
API version: 1.41
Go version: go1.16.8
Git commit: c2ea9bc
Built: Mon Oct 4 16:06:55 2021
OS/Arch: linux/arm
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:04:47 2021
OS/Arch: linux/arm
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Host OS:

Static hostname: raspberrypi
Icon name: computer
Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 5.10.63-v7l+
Architecture: arm

Docker engine commands:

docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana:latest-ubuntu

sudo docker run --volume /etc/mysql:/config --name mariadb-server -p 3307:3306 -e “MYSQL_ROOT_PASSWORD=password” -d linuxserver/mariadb

Could you post your docker logs too please?

linuxserver/mariadb docker container has ip 172.17.0.5

When I am trying to connect giving the host ip:

t=2021-10-28T11:13:45+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“Error 1045: Access denied for user ‘user’@‘172.17.0.1’ (using password: NO)”

t=2021-10-28T11:13:45+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/ds/query status=400 remote_addr=192.168.100.103 time_ms=58 size=218 referer=http://192.168.100.10:3000/datasources/edit/SmJqqnWgz

When I am trying to connect giving docker container name I am getting:

t=2021-10-28T11:20:15+0000 lvl=eror msg=“query error” logger=tsdb.mysql err=“dial tcp: lookup mariadb-server on 192.168.100.1:53: no such host”

t=2021-10-28T11:20:15+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=POST path=/api/ds/query status=400 remote_addr=192.168.100.103 time_ms=125 size=233 referer=http://192.168.100.10:3000/datasources/edit/SmJqqnWgz

Sorry, I wanted the docker logs mariadb

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 01-envfile: executing…
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing…
usermod: no changes


      _         ()
     | |  ___   _    __
     | | / __| | |  /  \
     | | \__ \ | | | () |
     |_| |___/ |_|  \__/

Brought to you by linuxserver.i

To support LSIO projects visit:
htts://www.linuxserver.io/donate

GID/UID

User uid: 911
User gid: 911

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing…
[cont-init.d] 30-config: exited 0.
[cont-init.d] 40-initialise-db: executing…
Setting Up Initial Databases
Installing MariaDB/MySQL system tables in ‘/config/databases’ …
2021-10-21 11:40:48 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can’t find file: ‘./mysql/’ (errno: 2 “No such file or directory”)
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following command:

‘/usr/bin/mysql_secure_installation’

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at htts://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd ‘/usr’ ; /usr/bin/mysqld_safe --datadir=’/config/databases’

You can test the MariaDB daemon with mysql-test-run.pl
cd ‘/usr/mysql-test’ ; perl mysql-test-run.pl

Please report any problems at htps://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
htts://dev.mysql.com
Consider joining MariaDB’s strong and vibrant community:
htts://mariadb.org/get-involved/

2021-10-21 11:40:50 0 [Note] mysqld (mysqld 10.5.12-MariaDB-log) starting as process 305 …
2021-10-21 11:40:50 0 [Note] InnoDB: Uses event mutexes
2021-10-21 11:40:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-21 11:40:50 0 [Note] InnoDB: Number of pools: 1
2021-10-21 11:40:50 0 [Note] InnoDB: Using generic crc32 instructions
2021-10-21 11:40:50 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-10-21 11:40:50 0 [Note] InnoDB: Using Linux native AIO
2021-10-21 11:40:50 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2021-10-21 11:40:50 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-21 11:40:51 0 [Note] InnoDB: 128 rollback segments are active.
2021-10-21 11:40:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-10-21 11:40:51 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
2021-10-21 11:40:51 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
2021-10-21 11:40:51 0 [Note] InnoDB: 10.5.12 started; log sequence number 45106; transaction id 20
2021-10-21 11:40:51 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool
2021-10-21 11:40:51 0 [Note] Plugin ‘FEEDBACK’ is disabled.
2021-10-21 11:40:51 0 [Note] InnoDB: Buffer pool(s) load completed at 211021 11:40:51
2021-10-21 11:40:51 0 [Note] Server socket created on IP: ‘::’.
2021-10-21 11:40:51 0 [Note] Reading of all Master_info entries succeeded
2021-10-21 11:40:51 0 [Note] Added new Master_info ‘’ to hash table
2021-10-21 11:40:51 0 [Note] mysqld: ready for connections.
Version: ‘10.5.12-MariaDB-log’ socket: ‘/run/mysqld/mysqld.sock’ port: 3306 MariaDB Server
2021-10-21 11:40:52 0 [Note] mysqld (initiated by: root[root] @ localhost []): Normal shutdown
2021-10-21 11:40:52 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-10-21 11:40:52 0 [Note] InnoDB: FTS optimize thread exiting.
2021-10-21 11:40:52 0 [Note] InnoDB: Starting shutdown…
2021-10-21 11:40:52 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool
2021-10-21 11:40:52 0 [Note] InnoDB: Buffer pool(s) dump completed at 211021 11:40:52
2021-10-21 11:40:53 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1”
2021-10-21 11:40:53 0 [Note] InnoDB: Shutdown completed; log sequence number 45118; transaction id 23
2021-10-21 11:40:53 0 [Note] mysqld: Shutdown complete

Database Setup Completed
[cont-init.d] 40-initialise-db: exited 0.
[cont-init.d] 90-custom-folders: executing…
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing…
[custom-init] no custom files found exiting…
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
211021 11:40:53 mysqld_safe Logging to ‘/config/databases/339d22bfff89.err’.
211021 11:40:54 mysqld_safe Starting mariadbd daemon with databases from /config/databases
[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 01-envfile: executing…
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing…
usermod: no changes


      _         ()
     | |  ___   _    __
     | | / __| | |  /  \
     | | \__ \ | | | () |
     |_| |___/ |_|  \__/

Brought to you by linuxserver.i

To support LSIO projects visit:
htps://www.linuxserver.io/donate/

GID/UID

User uid: 911
User gid: 911

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing…
[cont-init.d] 30-config: exited 0.
[cont-init.d] 40-initialise-db: executing…
[cont-init.d] 40-initialise-db: exited 0.
[cont-init.d] 90-custom-folders: executing…
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing…
[custom-init] no custom files found exiting…
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
211026 14:08:33 mysqld_safe Logging to ‘/config/databases/339d22bfff89.err’.
211026 14:08:33 mysqld_safe Starting mariadbd daemon with databases from /config/databases

ok, I would highly suggest starting with a clean folder for your /config mount, something looks to be causing it not to boot correctly.

Looking at your docker run, you’re missing bits our container requires.

docker run -d \
  --name=mariadb \
  -e PUID=1000 \
  -e PGID=1000 \
  -e MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORD \
  -e TZ=Europe/London \
  -p 3306:3306 \
  -v /home/username/mariadb:/config \
  --restart unless-stopped \
  lscr.io/linuxserver/mariadb

Could you try that and see how you get on?

thx, your first answer I guess was the correct one I have not given access to the user to this database and after specify ip address of host and it’s port, it is running. I will try to try with starting of docker as well again.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.