N8n and mysql

I have a problem with n8n in connection with mysql database. n8n and sql have been installed on a Synology NAS in Docker. I was able to work with it and n8n had all the data stored correctly in the sql. At some point, however, the connection to sql broke. I noticed that the Docker n8n container is no longer there. It was simply removed.
I was able to retrieve it several times and a test on another NAS had the same result. The Docker container has been deleted. A n8n on the same NAS and the same Docker system, but without sql runs perfectly.
Ps. I do not know English and help myself with Deepl

Translated with DeepL Translate: The world's most accurate translator (free version)

Information on your n8n setup

  • n8n version: latest
  • Database you’re using (mysql):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker]:

Richard

Hi @richard1818, I am sorry to hear you’re having trouble.

Do you see any server logs for your n8n docker container on your Synology NAS? Is there a chance the connection fails, preventing the n8n container to start as expected (with Synology just removing the container in such cases)?

After the installation I can work with these n8n aud this container and I see that the changes are also saved in the sql. At some point, however, the connection is no longer there and the container has disappeared from Docker. There is nothing in the Docker log file.
I’m completely mystified.

I don’t have a Synology NAS unfortunately, so can’t reproduce this first hand. But are there perhaps any system logs provided by the NAS that would have an explanation as to why a container has been removed?

There are a bunch of posts on their own forums and other places on the internet (not n8n-specific, just disappearing docker containers on Synology in general, starting in 2017 but still happening in 2022 from the looks of it). I couldn’t find an official statement from their team unfortunately, so it’s not super clear to me what might be going on here.

Does Synology allow you to configure a restart policy for your docker containers? If so, it might also be worth trying to set it to something other than no.

I have now started another installation and the following message appears in the shell after the installation. the Docker container is gone again.

sh-4.4# docker run -it --rm --name n8n -p 20029:5678 -e DB_TYPE=mysqldb -e DB_MYSQLDB_DATABASE=n8n -e DB_MYSQLDB_HOST=192.168.1.231 -e DB_MYSQLDB_PORT=3306 -e DB_MYSQLDB_USER=richard -e DB_MYSQLDB_PASSWORD=Richard12737! -v /volume1/docker/n8n:/home/node/.n8n n8nio/n8n n8n start
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 0.189.1
Editor is now accessible via:
http://localhost:5678/
Press “o” to open in Browser.
ERROR RESPONSE
Error: Not logged in
at /usr/local/lib/node_modules/n8n/dist/src/UserManagement/routes/auth.js:53:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /usr/local/lib/node_modules/n8n/dist/src/ResponseHelper.js:90:26 {
httpStatusCode: 401
}
Stopping n8n…

The Not logged in error wouldn’t be what’s stopping n8n. It’s just logged when your login session is expired.

The Stopping n8n… line suggests n8n is actively being shut down. I think it might be worth reaching out to Synology’s support team to understand why your n8n container is being stopped.