Steps
Read the connection error first
If the node fails before any SQL runs, the credential is the problem. A closed port gave
Connection refused(connect ECONNREFUSED 127.0.0.1:3306in the log). Watch the Host field: withlocalhost, n8n on Node 24 connected to the IPv6 address and failed withconnect ECONNREFUSED ::1:3307, even though MySQL was running on 127.0.0.1. Type127.0.0.1instead. A host that doesn't answer failed after the credential's 10 second Connect Timeout withThe connection timed out, consider setting the 'Retry on Fail' option in the node settings. In Docker,localhostis the n8n container itself: use the MySQL service name or the host's address.Decode the Access denied message
Access denied for user 'app'@'localhost' (using password: YES)means a wrong password, or a user that doesn't exist: a made-up user name gave the same message. (using password: NO) means the Password field is empty. A typo in the database name doesn't say "unknown database": it gaveAccess denied for user 'app'@'%' to database 'shopp', the same message as a user with no rights on that database. Check the spelling first, thenGRANT ALL ON shop.* TO 'app'@'%'. On MySQL 8.4, a user created only for another host ('tenonly'@'10.0.0.%') failed with the confusingPlugin 'mysql_native_password' is not loaded: create the user for'%'or for n8n's address.Give the credential the CA certificate for SSL
The MySQL credential has an SSL switch but no "ignore certificate" option. With SSL on and a self-signed server certificate (MySQL's own auto-generated one), the node failed with
self-signed certificate in certificate chain. Pasting the server'sca.pem(from the MySQL data folder, or your provider's CA bundle) into CA Certificate connected, andSsl_ciphershowed TLS_AES_256_GCM_SHA384. A user created withREQUIRE SSLand the SSL switch off got a plain Access denied (using password: YES), so if the password is surely right, try SSL.Match table names exactly and send clean values
On Linux, MySQL table names are case-sensitive: a table created as
CustomersgaveTable 'shop.customers' doesn't existboth in Execute Query and in the Select operation. Column names are not:select firstnameworked on afirstNamecolumn. Insert with auto-mapping sends every field of the item, so an extra field failed withUnknown column 'phone' in 'field list': remove it with an Edit Fields node first. MySQL runs in strict mode by default, so bad values fail instead of being cut:Incorrect integer value: 'abc' for column 'age' at row 1,Data too long for column 'name' at row 1, and for an ISO date from n8n,Incorrect datetime value: '2026-10-23T10:00:00.000Z'. Send dates as2026-10-23 10:00:00, for example with{{ $now.toFormat('yyyy-MM-dd HH:mm:ss') }}.Handle duplicates with Skip on Conflict or a unique match column
Inserting an email that already existed failed with
Duplicate entry 'a@x.io' for key 'users.email'. The Insert option Skip on Conflict returned{"success": true}and left the row alone. Insert or Update matching onemailupdated the existing row. Careful: MySQL's upsert only looks at unique keys, so matching onname, a column with no unique index, gave no error and quietly inserted a second row. With several items, the default batching (Single Query) and Transaction inserted nothing when one was a duplicate; Independent inserted the rows before it; Independent plus On Error: Continue inserted all the others.Use $1 parameters, not ?, and watch for number conversion
The node uses
$1,$2with Options → Query Parameters, not MySQL's?:where email = ?failed withYou have an error in your SQL syntax on line 1 near '?'. Without Query Parameters,$1givesParameter $1 referenced in query but no replacement value provided at index 1. A string is split on commas (Smith, Johnarrived asSmith), so pass an array:{{ [$json.name] }}. The node also turns anything that looks like a number into a number: the zip code007was stored as7, and0123and1e3came back as 123 and 1000. For codes with leading zeros, use the Insert operation, which kept007. Putting'{{ $json.name }}'straight into SQL broke on O'Brien with a syntax error; the same value as$1worked.
What we ran
On 23 October 2026 we ran n8n 2.43.7 (npm install, Node 24) against a local MySQL 8.4.7 Community Server with its auto-generated self-signed certificate, using the MySQL node version 2.5. Each case was a small workflow run with n8n execute: a Manual Trigger, sometimes a first MySQL node that produced the input items, then the MySQL node under test. 41 runs in total; every message below is copied from the execution data.
| Setup | Result |
|---|---|
| Correct host 127.0.0.1, port, database, user, password (SSL off) | Success: app@%, database shop, no cipher |
| Port 3306, nothing listening | Connection refused (log: connect ECONNREFUSED 127.0.0.1:3306) |
Host localhost, server listening on 127.0.0.1 only | Connection refused (log: connect ECONNREFUSED ::1:3307) |
| Host that doesn't answer, default Connect Timeout (10000 ms) | After about 10 s: The connection timed out, consider setting the 'Retry on Fail' option in the node settings |
| Wrong password | Access denied for user 'app'@'localhost' (using password: YES) |
| Password field empty | Access denied for user 'app'@'localhost' (using password: NO) |
| User that doesn't exist | Access denied for user 'nobody'@'localhost' (using password: YES) (same as a wrong password) |
| Database name typo (shopp) | Access denied for user 'app'@'%' to database 'shopp' (not "unknown database") |
| User with no rights on the database | Access denied for user 'noshop'@'%' to database 'shop' |
| User created only for another host ('tenonly'@'10.0.0.%') | Plugin 'mysql_native_password' is not loaded |
| User created with REQUIRE SSL, credential SSL off | Access denied for user 'sslonly'@'localhost' (using password: YES) |
| SSL on, no CA Certificate, server cert self-signed | self-signed certificate in certificate chain |
| SSL on + the server's ca.pem in CA Certificate | Success, Ssl_cipher TLS_AES_256_GCM_SHA384 |
Execute Query select * from customers (table created as Customers) | Table 'shop.customers' doesn't exist |
Execute Query select * from Customers | Success, 1 row |
| Select operation, table name typed as customers | Table 'shop.customers' doesn't exist |
Execute Query select firstname from Customers (column is firstName) | Success: column names are not case-sensitive |
| Execute Query insert of an email that exists | Duplicate entry 'a@x.io' for key 'users.email' |
| Insert operation, same duplicate | Same Duplicate entry error |
| Insert + Skip on Conflict | Success, output {"success": true}, row unchanged |
| Insert or Update, Column to Match On: email (unique) | Success, existing row updated (name and age) |
| Insert or Update, Column to Match On: name (not unique), name already in the table | No error, but a new row was inserted instead of updating |
| Insert, input item has a field the table lacks (phone) | Unknown column 'phone' in 'field list' |
| Insert, age = "abc" into an INT column | Incorrect integer value: 'abc' for column 'age' at row 1 |
| Insert, 22-character name into VARCHAR(20) | Data too long for column 'name' at row 1 |
Insert, 2026-10-23T10:00:00.000Z into a DATETIME column | Incorrect datetime value: '2026-10-23T10:00:00.000Z' for column 'created' at row 1 |
Insert, 2026-10-23 10:00:00 into the same column | Success |
where id = $1, no Query Parameters | Parameter $1 referenced in query but no replacement value provided at index 1 |
where email = ? with Query Parameters | You have an error in your SQL syntax on line 1 near '?' |
select $1, Query Parameters {{ 'Smith, John' }} | No error, but the value was cut to Smith |
Same, Query Parameters {{ ['Smith, John'] }} | Success, Smith, John |
Zip code 007 into a VARCHAR column through $3 | No error, but stored as 7 |
| Same zip code through the Insert operation (auto-map) | Stored as 007 |
select $1, $2 with ['0123', '1e3'] | Returned the numbers 123 and 1000 |
Name O'Brien put in the SQL with '{{ $json.name }}' | You have an error in your SQL syntax on line 1 near 'Brien'' |
Name O'Brien passed as $1 | Success (no error, 0 rows) |
| 3 items, 2nd a duplicate, Query Batching: Single Query (default) | Duplicate entry error, none of the 3 inserted |
| Same, Query Batching: Independent | Duplicate entry error, 1st row inserted, 3rd not |
| Same, Query Batching: Transaction | Duplicate entry error, none inserted |
| Same, Independent + On Error: Continue (regular output) | 1st and 3rd inserted; the duplicate came out as an item with an error field |
| Correct user with SSL on and the CA Certificate | Success, encrypted (TLS_AES_256_GCM_SHA384) |
Good to know
- Failed inserts still use up AUTO_INCREMENT ids: after these runs our rows had ids 1, 6, 7, 8, 9, 13, 17 and 19. Gaps are normal.
- MariaDB and older MySQL versions word some messages differently; the fixes are the same.
- Same node family, other database: n8n Postgres node errors. Other node errors: HTTP Request node errors, expression errors. Every message from our tests is in the n8n error message index.
What we didn't test
- SSH tunnel credentials, client certificates, hosted providers (PlanetScale, RDS, Azure) with their own CA bundles, MariaDB, and MySQL used as n8n's own database.
Start from a working agent
FAQ
Why does n8n say Access denied for user (using password: YES) when the password is right?
MySQL gives the same message for a user that doesn't exist and, for users created with REQUIRE SSL, when SSL is off. Check the User field, turn on SSL with the CA certificate, and check that the user exists for the host n8n connects from.
Why does the n8n MySQL node fail with ECONNREFUSED ::1 on localhost?
Node.js resolved localhost to the IPv6 address ::1, and MySQL was listening on 127.0.0.1 only. Put 127.0.0.1 in the Host field. In Docker, use the MySQL service name instead.
How do I fix self-signed certificate in certificate chain in the n8n MySQL credential?
Paste the server's CA certificate (ca.pem, or your provider's CA bundle) into the CA Certificate field with SSL on. The MySQL credential has no option to ignore certificate errors.
Why does n8n say Table doesn't exist when the table exists?
Table names are case-sensitive in MySQL on Linux. customers and Customers are different tables, so type the name exactly as it was created, in Execute Query and in the Select, Insert or Update operations.
Why does the n8n MySQL node drop the leading zeros of my value?
Query Parameters turn anything that looks like a number into a number, so 007 becomes 7. Use the Insert or Update operation for those fields, which kept 007 in our test.
Related guides
- n8n Postgres node errors: connection, SQL and insert fixes, 33 runs
- n8n Redis node errors and hangs: connection, TLS and Set fixes, 50 tests
- n8n MongoDB node errors: Authentication failed, Invalid JSON and query fixes, 40 runs
- n8n Supabase node errors: credentials, RLS and filter fixes, 41 runs
- n8n broke after updating to 2.x? Upgrade and migration errors, 20 tests
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes