I hope you can help me
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_DATABASE=n8n*
*ENV DB_MYSQLDB_HOST=<my_database_host>*
*ENV DB_MYSQLDB_PORT=3306*
*ENV DB_MYSQLDB_USER=<my_user>*
*ENV DB_MYSQLDB_PASSWORD=<mypass>*
*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.