MySQL · December 20, 2023

How to Fix MySQL Error 2035 - (CR_INVALID_BUFFER_USE) Can't send long data for non-string/non-binary data types (parameter: %d)

How to Fix MySQL Error 2035 - (CR_INVALID_BUFFER_USE) Can't send long data for non-string/non-binary data types (parameter: %d)

MySQL is a popular open-source relational database management system used by many websites and applications. However, like any software, it can encounter errors that can disrupt its normal operation. One such error is MySQL Error 2035, also known as CR_INVALID_BUFFER_USE, which occurs when trying to send long data for non-string/non-binary data types. In this article, we will explore the causes of this error and provide solutions to fix it.

Causes of MySQL Error 2035

MySQL Error 2035 is typically caused by one of the following reasons:

  • Incorrect data type: The error occurs when trying to send long data for non-string/non-binary data types. This means that the data being inserted or updated does not match the expected data type.
  • Insufficient buffer size: The buffer size allocated for the data being sent is not large enough to accommodate the length of the data.
  • Outdated MySQL version: Older versions of MySQL may have limitations or bugs that can trigger this error. Upgrading to the latest version can often resolve the issue.

Fixing MySQL Error 2035

Here are several solutions to fix MySQL Error 2035:

1. Check data types

Ensure that the data being inserted or updated matches the expected data type. For example, if you are trying to insert a long text into a column with a data type of VARCHAR, consider changing the data type to TEXT or LONGTEXT to accommodate the length of the data.

2. Increase buffer size

If the buffer size is too small to handle the data being sent, you can increase it by modifying the relevant MySQL configuration file. Locate the my.cnf or my.ini file and look for the max_allowed_packet parameter. Increase its value to a larger size, such as 64M or 128M, and restart the MySQL server for the changes to take effect.

[mysqld]
max_allowed_packet=64M

3. Upgrade MySQL

If you are using an older version of MySQL, consider upgrading to the latest stable release. Newer versions often include bug fixes and improvements that can resolve issues like MySQL Error 2035. Before upgrading, make sure to backup your databases and follow the upgrade instructions provided by MySQL.

Summary

MySQL Error 2035, also known as CR_INVALID_BUFFER_USE, can occur when trying to send long data for non-string/non-binary data types. This error can be caused by incorrect data types, insufficient buffer size, or outdated MySQL versions. To fix this error, ensure that the data types match, increase the buffer size, or consider upgrading MySQL to the latest version.

If you are experiencing MySQL Error 2035 or need reliable VPS hosting solutions, consider Server.HK. With our top-notch VPS hosting services, you can ensure the smooth operation of your MySQL databases and enjoy excellent performance and reliability.