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?
 
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:
 
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?
 
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.
 
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
 
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
 
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
 
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.
 
Yes PMA_PORT is 3306 & HOST is 127.0.0.1

I get the same (HY000/2002): Connection refused error with nextcloud, ttrss too
 
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.

Similar threads

Wordpress has been working, then yesterday I noticed updates, did these above and now I can't get to the...
Replies
0
Views
1,185
Def because of PMA_USER and PASSWORD variables. I don't have them, so I have to log in each time. Glad...
Replies
26
Views
9,013
problem solved by adding port: '3307', which is mariaDB port mark "solved"
Replies
1
Views
5,850
I don't see how that guide changes anything. It only removes orphaned components to free up space. But...
Replies
9
Views
416
  • Question
I want to install pandas, but I get an error. Please help me. Paste the error in SSH. pip install...
Replies
0
Views
1,532

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Back
Top