Open woshiyongkai opened 6 years ago
I saw the source code . In mysql8.0,We cannot excute the sql:
select @rownum := @rownum+1 as rank
but this sql is alright:
select @rownum := @rownum+1 as 'rank'
or like this
select @rownum := @rownum+1 as temprank
@woshiyongkai does your pull request resolve the issue? How many places did you need to patch? I really need HangFire working with MySql8. Thanks in advance.
Replace all "as rank" to "as 'rank' ". and I'm using it in MySql8.0
I'm also seeing this error with MySql 8.
MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank from
Set
, (select @rownum := 0) r where `Key' at line 3
Rank is a reserved word in MySql 8 so it needs to be wrapped in single quotes. https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-R
This is an easy fix, I wish someone would fix it and publish an updated nuget. Anyone who installs mysql today is going to get version 8 unless they choose specifically to use an older version.
@joeaudette ,hi how do you resolve this problem. We need to package it locally ,then install it in project?
@gouhan I have not solved it, for me the problem is only on my new dev machine where I have mysql 8.
I guess this project is not well maintained since there is a pull request to fix it above (3 months ago) that was never merged and now it has conflicts.
If this were blocking me I would fork it and fix it and publish my own nuget.
@joeaudette,thanks.
I have similar problem with MySQL 8.0.14, when I click 'Retries' or 'Recurrring Jobs' on Hangfire Dashboard page, it shows the error as below:
MySql.Data.MySqlClient.MySqlException: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank
from Set
,
(select @rownum := 0) r
where `Key' at line 3'
Use this stulzq/Hangfire.MySql.Core
Hi I had same issue, what I did is uninstalled the Hangfie.Mysql package and installed the Hangfie.Mysql.Core package. Now its working fine.
It's fine for mysql 5.7
But many errors in mysql8.0. The error info as follows
An unhandled exception occurred while processing the request. MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank from
HangfireSet
, (select @rownum := 0) r wh' at line 3MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in ResultSet.cs, line 43 MySqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank from
HangfireSet
, (select @rownum := 0) r wh' at line 3