question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error spam "[BentoBox] Could not check if key exists in database!" after MariaDB/MySQL version update

See original GitHub issue

Description

Describe the bug

I have updated my mysql servers and after that, bentobox spams console with this error: image

Steps to reproduce the behavior

Use latested MariaDB or MySQL server. Tested on both - same result. Only Bentobox has problems, any other plugin works fine.

Expected behavior

Screenshots and videos (Optional)

Environment

BentoBox Version (Mandatory)
1.11.0

Plugins (Optional)

[08:38:31 INFO]: Plugins (48): ActionHealth*, antiRedstoneClock, AuctionHouse, BentoBox, BossShopPro, ChatInjector*, ClearLag, ColoredSigns*, CommandButtons, CraftBook, Essentials, EssentialsChat, EssentialsProtect, EssentialsSpawn, HeadDatabase*, HolographicDisplays, ItemShops*, LiteJoin*, MorkazSk, MoxChatTitles, MoxCore, MoxFables, MoxPerms*, MoxPlayerParticles, MoxPremiumShop, MoxTokensDatabase*, MoxTransmutators, Multiverse-Core*, NoCheatPlus, PlaceholderAPI, PlugMan, ProtocolLib, ProtocolSupport, SAML, SK-NBeeT, SkQuery, skRayFall*, Skript, spark, SQLibrary*, TAB, TuSKe*, Vault, VoidGenerator, WorldBorder, WorldBorderAPI*, WorldEdit, WorldGuard

Additional context (Optional)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
MorkaZcommented, Mar 25, 2020

Thanks a lot tastybento. You have explained it very well. People like me will now have answer in the future.

Edit: Thanks a lot. It works! I was thinking that phpmyadmin uses only mysql commands & features to everything including dumping databases. I am sorry I did not give information that I was dumping databases and I was using phpmyadmin. I am hoping this world will have more developers like you 😃

2reactions
tastybentocommented, Mar 24, 2020

I found the issue: your phpMyAdmin is an old version and does not know how to export JSON databases so the table creation SQL is wrong. For example, here is the table creation SQL from the file you gave me for the Island table:

CREATE TABLE `world.bentobox.bentobox.database.objects.Island` (
  `json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
) ;

You can see that it does not make the uniqueId column. That’s why you are getting the error. There is no uniqueId to look up.

The correct SQLmust be like this:

CREATE TABLE `world.bentobox.bentobox.database.objects.Island` (
  `json` JSON, uniqueId VARCHAR(255) GENERATED ALWAYS AS (json->"$.uniqueId"), UNIQUE INDEX i (uniqueId)
);

The version of phpMyAdmin you are using is 4.6.6deb64. JSON support was added in 4.7.0, so you need to upgrade. Latest version is 4.9.5.. Having said that, I do not know for certain if it supports full exporting of JSON enabled databases because there is a still open bug on it here.

If phpMyAdmin doesn’t work, then use the mysqldump command to export the database:

mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump]

for example:

mysqldump -u tastybento -p bentobox > dump.sql

When I did this, the CREATE TABLE sql was correct, for example:

DROP TABLE IF EXISTS `world.bentobox.bentobox.database.objects.Island`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `world.bentobox.bentobox.database.objects.Island` (
  `json` json DEFAULT NULL,
  `uniqueId` varchar(255) GENERATED ALWAYS AS (json_extract(`json`,_utf8mb4'$.uniqueId')) VIRTUAL,
  UNIQUE KEY `i` (`uniqueId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

If you have a running version of the database then I recommend you use the mysqldump command to copy it to the newer database. Just in case, I cleaned up your file and here’s the fixed version: Bentobox_Caveblock.sql.zip However, I recommend using a proper dump from your working database.

I hope that fixes the problem for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MariaDB sql trigger to update if key exists or insert if doesn't ...
I want it to update some table values if the key already exists, or insert it with some new values if it doesn't...
Read more >
Database API - BentoBox World
BentoBox provides a database API for developers so you do not have to make one yourself. The BentoBox database can be chosen to...
Read more >
SOLVED - [CPANEL-32712] Updating to MariaDB 10.3.23 on ...
This MariaDB update occurs automatically when updating cPanel with a version that includes support for MariaDB 10.3. Symptoms The cPanel -> MySQL Databases...
Read more >
MySQL complains key exists but I can't find it
I am unable to drop foreign keys using ALTER TABLE syntax, it gives error "Table doesn't exist in the engine". That is with...
Read more >
interesting_websites.pdf - WordPress.com
The NSA can't remotely turn on all phones (erratasec.com) ... HFT Quote Stuffing is a software bug (chrisstucchio.com).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found