Docker | problem to create tables in mysql version 5.5.60

I hope you can help me :slight_smile:

Well, I’m running n8n in a docker container.
The “host machine” of my docker engine is running mysql on version 5.5.60.
I need to connect the n8n in the mysql of the “host machine” of the container.

I set the environment variables in my Dockerfile so that n8n uses mysql normally… everything seems to go well, until I run into the following error:

CREATE TABLE IF NOT EXISTS credentials_entity (id int NOT NULL AUTO_INCREMENT, name varchar(128) NOT NULL, data text NOT NULL, type varchar(32) NOT NULL, nodesAccess json NOT NULL , createdAt datetime NOT NULL, updatedAt datetime NOT NULL, INDEX IDX_07fde106c0b471d8cc80a64fc8 (type), PRIMARY KEY (id)) ENGINE=InnoDB

The situation is that my mysql version doesn’t support json data type.
Unfortunately mysql cannot be upgraded to the version that supports “json data type”, as this will break MANY other applications.
I ran n8n connected to a mysql container in the latest version and captured the sql statements: there are other tables using json data type.

I thought of some solutions:

  • Replace “json” data type with “longtext”.
  • I suspect that this would not cause problems, because from what I understand, when it comes to data type, “json” is an alias of “longtext”
    Impecilio: I didn’t find where I could make this change.

My Dockerfile:

*FROM n8nio/n8n*

*VOLUME /home/node/.n8n*

*RUN apk add bash*

*ENV DB_TYPE=mysqldb*
*ENV DB_MYSQLDB_HOST=<my_database_host>*

*RUN n8n start*

*EXPOSE 5678/tcp*

Although this solution doesn’t sound very smart, it was the only solution that came to mind.

Can any of you who have a clearer understanding of this context give me a suggestion, please?

I anticipate my thanks.

Welcome to the community @josimarrocha0197!

Very sorry not have much to say right now to solve your actual problem, but something else that is maybe helpful. Do not try to get it to work with MySQL and rather set up Postgres.

The reasons behind that are mainly:

  1. That is the database (apart from SQLite) that most of our users use, we do the most testing, you will have the least amount of issues with (for the previously mentioned reasons), and will find more people to be able to help you
  2. I am currently suggesting internally to drop MySQL support as fast as possible (almost nobody uses it in combination with n8n and so all the additional work is simply not worth it in my eyes, better to use those resources on something else and move faster)

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