79461735

Date: 2025-02-23 18:12:13
Score: 0.5
Natty:
Report link

I recently got this same error, and applied the suggested fix. However, what was not shared in this StackOverflow post is that MySql.Data changed something internally: the IgnorePrepare property used to be True until 8.0.23. This change makes Prepare() actually create prepared statements on the server whereas it did not before. In our case the database ran out of prepared statements (Can't create more than max_prepared_stmt_count statements).

Removing Prepare() for statements that just use parameters and are not reused works better.

References:

https://mysqlconnector.net/tutorials/migrating-from-connector-net/

IgnorePrepare
true for ≤ 8.0.22; false for ≥ 8.0.23

https://dev.mysql.com/doc/relnotes/connector-net/en/news-8-0-23.html

The IgnorePrepare connection-string option was deprecated in the Connector/NET 8.0.23 release and removed in the Connector/NET 8.0.24 release.

The removed option instructed Connector/NET to ignore all calls to MySqlCommand.Prepare() that were made using the classic MySQL protocol. (Bug #31872906)
Reasons:
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Diamondo25