Keyword

Problem with K2 and MySQL 8.0.23

  • Panagiotis Karamalis
  • Panagiotis Karamalis's Avatar Topic Author
  • Offline
  • New Member
More
3 years 2 months ago - 3 years 2 months ago #178017 by Panagiotis Karamalis
Problem with K2 and MySQL 8.0.23 was created by Panagiotis Karamalis
Hi! I have been using K2 (Version 2.10.3) on an old Joomla 3.9.24. I have recently upgraded the server (Microsoft-IIS/8.5) to PHP 7.4.7 and MySQL 8.0.23.

Although Joomla works ok, it seems that I can't post new K2 items since (MySQL "syntax error 1064 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 ')}' at line 1").

My question is, is there any workaround, or should I downgrade MySQL?

Thanks in advance
Last edit: 3 years 2 months ago by Panagiotis Karamalis. Reason: Syntax error

Please Log in or Create an account to join the conversation.

More
3 years 2 months ago #178018 by JoomlaWorks
Replied by JoomlaWorks on topic Problem with K2 and MySQL 8.0.23
I doubt the issue is K2 here as the main problem I know between Joomla 3 and MySQL 8 is an incompatibility with the authentication plugin that is installed by default with MySQL 8.

See this: docs.joomla.org/Joomla_and_MySQL_8

Assuming there is no other issue, you can try the workaround mentioned in the link above.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Panagiotis Karamalis
  • Panagiotis Karamalis's Avatar Topic Author
  • Offline
  • New Member
More
3 years 2 months ago #178023 by Panagiotis Karamalis
Replied by Panagiotis Karamalis on topic Problem with K2 and MySQL 8.0.23
Thanks for your answer. I have already changed the authentication plugin as per the guide you have provided, or else Joomla 3 wouldn't start.

Joomla works fine, only new items in K2 are not saved. It most probably has to do with a query not compatible with MySQL 8?

Please Log in or Create an account to join the conversation.

More
3 years 2 months ago - 3 years 2 months ago #178025 by JoomlaWorks
Replied by JoomlaWorks on topic Problem with K2 and MySQL 8.0.23
It depends, especially if you have other plugins extending K2's queries (which is possible).

If you can get me a detailed error log and given it's indeed a K2 issue (and not related to some 3rd party plugin), I'll fix it on the spot.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 3 years 2 months ago by JoomlaWorks. Reason: Added clarification

Please Log in or Create an account to join the conversation.

  • Panagiotis Karamalis
  • Panagiotis Karamalis's Avatar Topic Author
  • Offline
  • New Member
More
3 years 2 months ago #178026 by Panagiotis Karamalis
Replied by Panagiotis Karamalis on topic Problem with K2 and MySQL 8.0.23
Thanks again.

Here is the example of the debug log (with setting "Log almost everything" set to on) when trying to save a new K2 item:

#Date: 2021-02-09 16:06:34 UTC
#Software: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

#Fields: datetime priority clientip category message
2021-02-09T16:06:34+00:00 ERROR **.**.**.** database-error Database query failed (error # 1064): 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 ')}' at line 1
2021-02-09T16:06:34+00:00 CRITICAL **.**.**.** error Uncaught \Throwable of type JDatabaseExceptionExecuting thrown. Stack trace: #0 C:\[undisclosed-path]\libraries\joomla\database\database.php(33): JDatabaseDriverMysqli->execute()
#1 C:\[undisclosed-path]\administrator\components\com_k2\models\item.php(664): JDatabase->query()
#2 C:\[undisclosed-path]\administrator\components\com_k2\controllers\item.php(27): K2ModelItem->save()
#3 C:\[undisclosed-path]\libraries\src\MVC\Controller\BaseController.php(710): K2ControllerItem->save()
#4 C:\[undisclosed-path]\administrator\components\com_k2\k2.php(147): Joomla\CMS\MVC\Controller\BaseController->execute()
#5 C:\[undisclosed-path]\libraries\src\Component\ComponentHelper.php(402): require_once('C:\\inetpub\\Priv...')
#6 C:\[undisclosed-path]\libraries\src\Component\ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent()
#7 C:\[undisclosed-path]\libraries\src\Application\AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent()
#8 C:\[undisclosed-path]\libraries\src\Application\AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch()
#9 C:\[undisclosed-path]\libraries\src\Application\CMSApplication.php(196): Joomla\CMS\Application\AdministratorApplication->doExecute()
#10 C:\[undisclosed-path]\administrator\index.php(51): Joomla\CMS\Application\CMSApplication->execute()
#11 {main}

Please Log in or Create an account to join the conversation.

More
3 years 2 months ago #178029 by JoomlaWorks
Replied by JoomlaWorks on topic Problem with K2 and MySQL 8.0.23
In the file \administrator\components\com_k2\models\item.php change line 662 from:
$query = "DELETE FROM #__k2_tags_xref WHERE itemID={intval($row->id)}";

to:
$query = "DELETE FROM #__k2_tags_xref WHERE itemID=".(int) $row->id;

The syntax is indeed wacky there... Let me know.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Panagiotis Karamalis
  • Panagiotis Karamalis's Avatar Topic Author
  • Offline
  • New Member
More
3 years 2 months ago #178031 by Panagiotis Karamalis
Replied by Panagiotis Karamalis on topic Problem with K2 and MySQL 8.0.23
Still the same error. Additional (probably similar) problem: Items wont get trashed.

Please Log in or Create an account to join the conversation.

More
3 years 2 months ago #178034 by JoomlaWorks
Replied by JoomlaWorks on topic Problem with K2 and MySQL 8.0.23
There are 2-3 similar instances of that code in SQL queries.

Try v2.10.4 (dev) from: getk2.org/downloads/?f=K2_Development_Release.zip

That should fix the issues.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Panagiotis Karamalis
  • Panagiotis Karamalis's Avatar Topic Author
  • Offline
  • New Member
More
3 years 2 months ago - 3 years 2 months ago #178039 by Panagiotis Karamalis
Replied by Panagiotis Karamalis on topic Problem with K2 and MySQL 8.0.23
Thanks. Unfortunately, K2 v2.10.4 [Dev Build 20210205] still shows the same error (1064 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 '' at line 1) when trying to insert any item.

Moreover, there are no errors shown, however, items cannot be trashed or modified.
Last edit: 3 years 2 months ago by Panagiotis Karamalis. Reason: Clarification

Please Log in or Create an account to join the conversation.

More
3 years 2 months ago #178046 by JoomlaWorks
Replied by JoomlaWorks on topic Problem with K2 and MySQL 8.0.23
Can you send me the full error log once more?

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum