Question MariaDB 10 Error: 2006 MySQL server has gone away

Currently reading
Question MariaDB 10 Error: 2006 MySQL server has gone away

13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
Hello

I have the MariaDB package installed. I can reach the MariaDB install by logging in with phpMyAdmin using the root credentials & default port. However I cannot connect to the DB from any other Docker application. Nextcloud, Tiny Tiny RSS etc. All of them return Error: 2006 MySQL server has gone away - I've tried localhost, 192.xx.xx.xx, 127.0.0.1 etc - Nohting works. What am I doing wrong?
 

Shadow

Subscriber
528
173
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
So is your MariaDB instance also running as a Docker container or did you install it from the Package Center under 'Third-Party' apps?
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
So is your MariaDB instance also running as a Docker container or did you install it from the Package Center under 'Third-Party' apps?

Package Center under 'Third-Party' apps
 

Shadow

Subscriber
528
173
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
In which Docker network did you attach your containers? Cuz for example I don't think 192.xx.xx.xx. or 172.0.0.1 works if you attached them to the Bridge network only.
 
1,494
646
NAS
DS220+ : DS1019+ : DS216+II : DS118 : DS120j : APC Back UPS ES 700 — Mac/iOS user
If you have the firewall turned on, try to turn it off briefly and check. A shot in the dark as I was passing by :)
 

jeyare

Subscriber
1,600
540
hands off from 3rd party packages installed directly to the NAS
it has been discussed many times here, that Docker container is better
so
you can install MariaDB docker container:
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
In which Docker network did you attach your containers? Cuz for example I don't think 192.xx.xx.xx. or 172.0.0.1 works if you attached them to the Bridge network only.
I see, yes. I have bridge network set. But if I use the same network as docker host that knocks out the ability to run say tt rss outside of the 80/443 port config?
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
hands off from 3rd party packages installed directly to the NAS
it has been discussed many times here, that Docker container is better
so
you can install MariaDB docker container:

thanks - I'll look at this
 

Shadow

Subscriber
528
173
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
I see, yes. I have bridge network set. But if I use the same network as docker host that knocks out the ability to run say tt rss outside of the 80/443 port config?

You can't then run it on port 80/443. You'd have to run it on different ports, but you can then still reach the web portals on 80/443 via reverse proxy. But your Dockers should in this case coommunicate to the 'gateway IP' of the Docker network they are now attached to. In my case, the NAS IP in the perspective of your containers would then be: 172.17.0.1 .

1597849845983.png
 
Last edited:
By default, for the MariaDB package, the root user is only allowed to login from localhost or 127.0.0.1. I analysed it a couple of days ago.

If you want the root user to be allowed to login from somewhere else, you will need to create a new user that is allowed to login:
SQL:
CREATE USER 'root'@'%' IDENTIFIED BY 'Password1!';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Make sure to replace the password (without removing the single quotes that wrapp your password) with your own.
Instead of GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;, a subset of priviliges can be granted. Instead of allowing all hosts to login with '%', an ip range could be specified (smth like '172.17.0.%' instead of '%')

Many containers also allow to use a pre-existing database, which can be created like this:
SQL:
CREATE DATABASE IF NOT EXISTS app_db_name;
CREATE USER 'app_db_user'@'%' IDENTIFIED BY 'Password1!';
GRANT ALL ON app_db_name.* TO 'app_db_user'@'%';
Make sure to replace app_db_name, app_db_user and Password1! with whatever you specify in the container configuration.

Note:
- "Enable TCP/IP connection" needs to be checked in the MariaDB config. On the same screen, you will see which port it is listenning on. Write it down, as your (containerized) application will need to use this port when connecting to MariaDB.
- you can use the phpMyAdmin package or the cli command /usr/local/mariadb10/bin/mysql -u root -p to connect to MariaDB and paste the SQL statements there.
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
Thanks All

I've managed to setup my MariaDB docker image. Got slightly further and slightly further back.

Now when I try to setup TTRSS DB connection I get

using 127.0.0.1: SQLSTATE[HY000] [2002] Connection refused
using localhost: SQLSTATE[HY000] [2002] No such file or directory

I am using root & root password to log in

1597914477660.png
 

Rusty

Moderator
NAS Support
2,463
738
www.blackvoid.club
NAS
DS412+, DS718+, DS918+, 2x RS3614RPxs+ with expansions
Router
  1. RT1900ac
  2. RT2600ac
  3. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
Now when I try to setup TTRSS DB
What image are you using?

TTRSS uses config_mariadb.php file where you can configure all DB actions as well as everything else related to your TTRSS instance

Code:
define('DB_TYPE', 'mysql');                                                                                                                   
define('DB_HOST', 'NAS_IP');                                                                                                           
define('DB_USER', 'ttrss_user');                                                                                                                   
define('DB_NAME', 'ttrss_database');                                                                                                                   
define('DB_PASS', 'ttrss_pass');                                                                                                                   
define('DB_PORT', '3307');

This is one example
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
Thing is it's the same no matter what application I try to use. For example PHPmyAdmin returns connection refused

1597918594984.png
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
And you have done this what @one-eyed-king has posted?

I have, yes although that was related to the MariaDB package install not docker I believe?

It's like the docker mariadb image is refusing any connections from other docker? I've changed the custom.cnf file bind address to be 0.0.0.0 and 127.0.0.1 both yield the same connection refused
 

Rusty

Moderator
NAS Support
2,463
738
www.blackvoid.club
NAS
DS412+, DS718+, DS918+, 2x RS3614RPxs+ with expansions
Router
  1. RT1900ac
  2. RT2600ac
  3. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
I have, yes although that was related to the MariaDB package install not docker I believe?

It's like the docker mariadb image is refusing any connections from other docker? I've changed the custom.cnf file bind address to be 0.0.0.0 and 127.0.0.1 both yield the same connection refused
You are correct, sorry my mistake. So this is running via docker.

Are you using PMA_PORT and PMA_HOST variables in your phpMyAdmin container? set them to your nas IP and the local docker port value of your mariadb container.
 
13
1
NAS
DS918+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
Yes PMA_PORT is 3306 & HOST is 127.0.0.1

I get the same (HY000/2002): Connection refused error with nextcloud, ttrss too
 

Rusty

Moderator
NAS Support
2,463
738
www.blackvoid.club
NAS
DS412+, DS718+, DS918+, 2x RS3614RPxs+ with expansions
Router
  1. RT1900ac
  2. RT2600ac
  3. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
Yes PMA_PORT is 3306 & HOST is 127.0.0.1

I get the same (HY000/2002): Connection refused error with nextcloud, ttrss too
Set HOST to your NAS LAN IP
 

Shadow

Subscriber
528
173
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
So you've decided to go to a Dockerized MariaDB? Good choice.

Perhaps this topic can also give some extra information as this is where I got MariaDB and PhPMyAdmin working via Docker.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Similar threads

Similar threads

Top