// guides · n8n error index

n8n MySQL node errors: Access denied, SSL and SQL fixes, 41 runs

Fix n8n MySQL node errors: Access denied for user, Connection refused on localhost (::1), self-signed certificate, table doesn't exist, Duplicate entry, Incorrect datetime value and $1 parameter surprises. From 41 real runs on n8n 2.43.7 and MySQL 8.4.

Updated 2026-10-23 · about 10 minutes

Still stuck after these steps? Paste your exact n8n error and we'll reproduce it and email you the fix, free →

Steps

  1. 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:3306 in the log). Watch the Host field: with localhost, n8n on Node 24 connected to the IPv6 address and failed with connect ECONNREFUSED ::1:3307, even though MySQL was running on 127.0.0.1. Type 127.0.0.1 instead. A host that doesn't answer failed after the credential's 10 second Connect Timeout with The connection timed out, consider setting the 'Retry on Fail' option in the node settings. In Docker, localhost is the n8n container itself: use the MySQL service name or the host's address.

  2. 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 gave Access denied for user 'app'@'%' to database 'shopp', the same message as a user with no rights on that database. Check the spelling first, then GRANT ALL ON shop.* TO 'app'@'%'. On MySQL 8.4, a user created only for another host ('tenonly'@'10.0.0.%') failed with the confusing Plugin 'mysql_native_password' is not loaded: create the user for '%' or for n8n's address.

  3. 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's ca.pem (from the MySQL data folder, or your provider's CA bundle) into CA Certificate connected, and Ssl_cipher showed TLS_AES_256_GCM_SHA384. A user created with REQUIRE SSL and the SSL switch off got a plain Access denied (using password: YES), so if the password is surely right, try SSL.

  4. Match table names exactly and send clean values

    On Linux, MySQL table names are case-sensitive: a table created as Customers gave Table 'shop.customers' doesn't exist both in Execute Query and in the Select operation. Column names are not: select firstname worked on a firstName column. Insert with auto-mapping sends every field of the item, so an extra field failed with Unknown 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 as 2026-10-23 10:00:00, for example with {{ $now.toFormat('yyyy-MM-dd HH:mm:ss') }}.

  5. 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 on email updated the existing row. Careful: MySQL's upsert only looks at unique keys, so matching on name, 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.

  6. Use $1 parameters, not ?, and watch for number conversion

    The node uses $1, $2 with Options → Query Parameters, not MySQL's ?: where email = ? failed with You have an error in your SQL syntax on line 1 near '?'. Without Query Parameters, $1 gives Parameter $1 referenced in query but no replacement value provided at index 1. A string is split on commas (Smith, John arrived as Smith), so pass an array: {{ [$json.name] }}. The node also turns anything that looks like a number into a number: the zip code 007 was stored as 7, and 0123 and 1e3 came back as 123 and 1000. For codes with leading zeros, use the Insert operation, which kept 007. Putting '{{ $json.name }}' straight into SQL broke on O'Brien with a syntax error; the same value as $1 worked.

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.

SetupResult
Correct host 127.0.0.1, port, database, user, password (SSL off)Success: app@%, database shop, no cipher
Port 3306, nothing listeningConnection refused (log: connect ECONNREFUSED 127.0.0.1:3306)
Host localhost, server listening on 127.0.0.1 onlyConnection 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 passwordAccess denied for user 'app'@'localhost' (using password: YES)
Password field emptyAccess denied for user 'app'@'localhost' (using password: NO)
User that doesn't existAccess 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 databaseAccess 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 offAccess denied for user 'sslonly'@'localhost' (using password: YES)
SSL on, no CA Certificate, server cert self-signedself-signed certificate in certificate chain
SSL on + the server's ca.pem in CA CertificateSuccess, 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 CustomersSuccess, 1 row
Select operation, table name typed as customersTable '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 existsDuplicate entry 'a@x.io' for key 'users.email'
Insert operation, same duplicateSame Duplicate entry error
Insert + Skip on ConflictSuccess, 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 tableNo 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 columnIncorrect 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 columnIncorrect datetime value: '2026-10-23T10:00:00.000Z' for column 'created' at row 1
Insert, 2026-10-23 10:00:00 into the same columnSuccess
where id = $1, no Query ParametersParameter $1 referenced in query but no replacement value provided at index 1
where email = ? with Query ParametersYou 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 $3No 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 $1Success (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: IndependentDuplicate entry error, 1st row inserted, 3rd not
Same, Query Batching: TransactionDuplicate 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 CertificateSuccess, encrypted (TLS_AES_256_GCM_SHA384)

Good to know

What we didn't test

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

New guides

Still stuck on your n8n error?

Paste the exact error and say what the workflow should do. We reproduce it on a real n8n install and email you the fix or a working workflow, usually within 24h. Free while we're in beta.

We'll only email you about your error and TaskToAgent.