MySQL reports fatal error encoded during command execution. How to solve the error

Add to the connection string

Allow User Variables=True

Because the SQL statement contains custom parameters, such as @ rownum
allow user variables = true allows users to customize parameters.

Read More: