arnoldasgudas / Hangfire.MySqlStorage

MySql storage for Hangfire - fire-and-forget, delayed and recurring tasks runner
GNU Lesser General Public License v3.0
175 stars 114 forks source link

MySql8.0 is not available #48

Open woshiyongkai opened 6 years ago

woshiyongkai commented 6 years ago

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 3

MySqlConnector.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

woshiyongkai commented 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

julioapm commented 6 years ago

@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.

andrepontesmelo commented 6 years ago
woshiyongkai commented 6 years ago

Replace all "as rank" to "as 'rank' ". and I'm using it in MySql8.0

joeaudette commented 5 years ago

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.

gouhan commented 5 years ago

@joeaudette ,hi how do you resolve this problem. We need to package it locally ,then install it in project?

joeaudette commented 5 years ago

@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.

gouhan commented 5 years ago

@joeaudette,thanks.

william19821101 commented 5 years ago

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'

wwwu commented 5 years ago

Use this stulzq/Hangfire.MySql.Core image

KG1805 commented 4 years ago

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.