MySQL Error 1084 is encountered when you attempt to load data into a table with BLOB or TEXT columns using a fixed row format. This error message advises the use of a field-terminated format instead. Below, we’ll cover scenarios that might lead to this error and provide examples and guidance on how to fix it.
Scenario 1: Using LOAD DATA INFILE with Fixed Row Format
When using LOAD DATA INFILE
to import data into a table that includes BLOB or TEXT columns, specifying a fixed row format can trigger this error.
Diagnosis:
Review your LOAD DATA INFILE
statement for the FIXED
keyword or the absence of field terminators.
Fix:
Specify a field terminator using the FIELDS TERMINATED BY
clause:
LOAD DATA INFILE 'path/to/your/file.txt'
INTO TABLE your_table
FIELDS TERMINATED BY ','
(column1, column2, column3);
Ensure that the terminator you choose (e.g., a comma in this example) matches the format of your input file.
Scenario 2: Creating a Table with ROW_FORMAT=FIXED
Error 1084 can also occur if you try to create a table with the ROW_FORMAT=FIXED
option when the table includes BLOB or TEXT columns.
Diagnosis:
Check your CREATE TABLE
statement for the ROW_FORMAT=FIXED
option.
Fix:
Remove the ROW_FORMAT=FIXED
option or change it to ROW_FORMAT=DYNAMIC
:
CREATE TABLE your_table (
column1 INT,
column2 BLOB
) ROW_FORMAT=DYNAMIC;
This change allows MySQL to handle BLOB and TEXT columns with a dynamic row format.
Scenario 3: Altering a Table to Use ROW_FORMAT=FIXED
Attempting to alter an existing table to use a fixed row format with BLOB or TEXT columns will result in Error 1084.
Diagnosis:
Inspect your ALTER TABLE
statement for the ROW_FORMAT=FIXED
option.
Fix:
Alter the table to use a dynamic row format instead:
ALTER TABLE your_table ROW_FORMAT=DYNAMIC;
This will enable the table to store BLOB and TEXT columns without encountering the error.
Conclusion
MySQL Error 1084 arises from the incompatibility of fixed row formats with BLOB and TEXT data types. To resolve this error, ensure that you use field terminators with LOAD DATA INFILE
statements and avoid specifying a fixed row format for tables containing BLOB or TEXT columns. Always use a dynamic row format for such tables to comply with MySQL requirements.
When importing data or defining table structures, it’s important to understand the characteristics of the data types you’re working with and to choose the appropriate options for your SQL statements. If you’re unsure about the format of your data or the best practices for table creation, consult the MySQL Documentation for guidance on handling BLOB and TEXT data types effectively.