ERROR 1210 occurs when a MySQL function, stored procedure, or prepared statement receives arguments that do not match the function definition in type, count, or format. This commonly happens with prepared statements using LIMIT clauses, UNSIGNED parameters with IFNULL, or DATA DIRECTORY options.
ERROR 1210 (SQLSTATE HY000) is a generic MySQL error that signals incorrect arguments were passed to a function, stored procedure, or prepared statement. MySQL evaluates the arguments against the function signature and rejects the call if the count, data types, or formats do not match. The error message typically includes a placeholder (%s) indicating which function received the incorrect arguments. This error is particularly common in prepared statements where type coercion and validation rules are stricter than in regular SQL queries. Unlike some functions that perform implicit type conversion, prepared statements enforce exact argument matching to maintain type safety.
Review the full error message from MySQL. The error should indicate which function or procedure received incorrect arguments. Example:
ERROR 1210 (HY000): Incorrect arguments to EXECUTE
ERROR 1210 (HY000): Incorrect arguments to DATA DIRECTORYThis tells you exactly where the problem is.
If using prepared statements, ensure the number of placeholders (?) matches the number of arguments passed to EXECUTE or the bind parameters:
-- INCORRECT: 3 placeholders but only 2 arguments
PREPARE stmt FROM "SELECT * FROM users WHERE id = ? AND status = ? AND role = ?";
EXECUTE stmt USING @id, @status; -- Only 2 variables
-- CORRECT: 3 placeholders and 3 arguments
PREPARE stmt FROM "SELECT * FROM users WHERE id = ? AND status = ? AND role = ?";
EXECUTE stmt USING @id, @status, @role; -- All 3 variablesCompare the data types of arguments with the function signature. Prepare a simple test:
-- If function expects INT but you pass UNSIGNED INT
SET @unsigned_val = CAST(10 AS UNSIGNED); -- UNSIGNED
PREPARE stmt FROM "SELECT * FROM table LIMIT ?";
EXECUTE stmt USING @unsigned_val; -- May fail
-- Convert to match expected type
SET @signed_val = CAST(10 AS SIGNED); -- SIGNED (default)
EXECUTE stmt USING @signed_val; -- Should workIf using IFNULL with UNSIGNED parameters in a LIMIT clause, the function may fail type checking. Explicitly convert to SIGNED:
-- PROBLEMATIC
SET @u_rows = IFNULL(u_rows, 10); -- May cause ERROR 1210 if u_rows is UNSIGNED
PREPARE stmt FROM "SELECT * FROM table LIMIT ?";
EXECUTE stmt USING @u_rows;
-- SOLUTION: Convert to SIGNED explicitly
SET @u_rows = CONVERT(IFNULL(u_rows, 10), SIGNED);
PREPARE stmt FROM "SELECT * FROM table LIMIT ?";
EXECUTE stmt USING @u_rows; -- Should workFor prepared statements with UNSIGNED parameters, replace IFNULL with explicit IF logic:
-- PROBLEMATIC
SET @u_rows = IFNULL(u_rows, 10);
PREPARE stmt FROM "SELECT * FROM table LIMIT ?";
EXECUTE stmt USING @u_rows;
-- ALTERNATIVE: Use separate SET and IF
SET @u_rows = u_rows;
IF @u_rows IS NULL THEN
SET @u_rows = 10;
END IF;
PREPARE stmt FROM "SELECT * FROM table LIMIT ?";
EXECUTE stmt USING @u_rows; -- More compatibleIf using prepared statements with many placeholders (approaching 65536), reduce the number of placeholders per statement:
-- PROBLEMATIC: Too many placeholders with empty strings
PREPARE stmt FROM "INSERT INTO table VALUES (?, ?, ?, ...)";
-- With 65535 placeholders - may fail
-- SOLUTION: Split into multiple batches
-- Batch 1: First 60000 placeholders
PREPARE stmt1 FROM "INSERT INTO table VALUES (?, ?, ..., ?)";
EXECUTE stmt1 USING @val1, @val2, ..., @val60000;
-- Batch 2: Remaining values
PREPARE stmt2 FROM "INSERT INTO table VALUES (?, ?, ..., ?)";
EXECUTE stmt2 USING @val60001, ..., @valN;If you are experiencing ERROR 1210 with a version mismatch between libmysqlclient and MySQL server:
# For Ubuntu/Debian (version incompatibility between client and server)
sudo apt-get update
sudo apt-get install --only-upgrade libmysqlclient21
# Or for development
sudo apt-get install --only-upgrade libmysqlclient-dev
# Verify versions match
mysql --version
mysqldump --versionEnsure your client library version is compatible with your MySQL server version (ideally within the same major version).
If ERROR 1210 occurs with CREATE TABLE and DATA DIRECTORY:
-- PROBLEMATIC: Invalid path format or unsupported argument
CREATE TABLE users (
id INT PRIMARY KEY
) DATA DIRECTORY = '/invalid/path/';
-- SOLUTION: Use valid paths and ensure table option is supported
-- Check MySQL docs for your version - DATA DIRECTORY may require specific configurations
CREATE TABLE users (
id INT PRIMARY KEY
);Consult MySQL documentation for your specific version regarding DATA DIRECTORY support and requirements.
ERROR 1210 can be particularly tricky because prepared statements use stricter type validation than regular SQL queries. This is intentional for security and consistency, but it means implicit type conversions that work in regular queries might fail in prepared statements.
The error is version-dependent: MySQL 5.0.45 introduced stricter type checking in prepared statements that would catch these issues. Upgrading to newer MySQL versions (5.7, 8.0) generally has better error messages that help identify the exact argument causing the problem.
When debugging, enable the MySQL query log to see the exact prepared statement and arguments:
SET GLOBAL general_log = ON;
SET GLOBAL log_output = 'TABLE';
SELECT * FROM mysql.general_log;
SET GLOBAL general_log = OFF;For application developers using MySQL drivers (go-sql-driver, node-mysql2, etc.), ensure you are using the latest version of your driver, as many have implemented automatic type handling that works around these issues.
ERROR 1064: You have an error in your SQL syntax
How to fix "ERROR 1064: You have an error in your SQL syntax" in MySQL
ERROR 1054: Unknown column in field list
Unknown column in field list
ER_WINDOW_RANGE_FRAME_NUMERIC_TYPE (3589): RANGE frame requires numeric ORDER BY expression
RANGE frame requires numeric ORDER BY expression in MySQL window functions
CR_ALREADY_CONNECTED (2058): Handle already connected
How to fix "CR_ALREADY_CONNECTED (2058): Handle already connected" in MySQL
ER_WINDOW_DUPLICATE_NAME (3591): Duplicate window name
How to fix ER_WINDOW_DUPLICATE_NAME (3591) in MySQL window functions