MyBB Community Forums

Full Version: SQL Error When Activating Certain Plugins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello --

So recently I had to restart my forum completely because of some bug that happened and I could never get it figured out. I hate I had to do that because I lost close to 5 months worth of work.

Anyways, the plugins I used before all this happened were working fine but now some of the ones I'm trying to reinstall gives me a SQL error when I go to activate or install it. It doesn't give a specific code just says, "MyBB has experienced an internal SQL error and cannot continue."
I seen others had similar problems but I still couldn't find a solution.

Thanks for taking the time to read my thread!
Adjust your your error handling settings  - you need more information.  Check your ACP - Server and Optimization Options.  More on this in many threads - here's one that popped up in a search.

I've seen old plugins work fine when someone upgraded over the top of them.  But fail with an error if you uninstall or install fresh with a modern setup.  Often because of backend database upgrades.

good luck....
See if you have an error.log file in your forum's root folder which should include details on the error. If not, go to ACP > Server and Optimization Options > Error Type Medium > set to "Warnings and Errors", and save.

Usually SQL errors when installing plugins is due to incorrectly written queries to insert settings and templates where plugin authors have set values to NULL instead of not specifying them at all, which can cause errors in some MySQL setups. Once we can see the specific error we'll be able to see for sure.
(2021-08-08, 07:33 PM)Matt Wrote: [ -> ]See if you have an error.log file in your forum's root folder which should include details on the error. If not, go to ACP > Server and Optimization Options > Error Type Medium > set to "Warnings and Errors", and save.

Usually SQL errors when installing plugins is due to incorrectly written queries to insert settings and templates where plugin authors have set values to NULL instead of not specifying them at all, which can cause errors in some MySQL setups. Once we can see the specific error we'll be able to see for sure.
(2021-08-08, 07:06 PM)nixer55 Wrote: [ -> ]Adjust your your error handling settings  - you need more information.  Check your ACP - Server and Optimization Options.  More on this in many threads - here's one that popped up in a search.

I've seen old plugins work fine when someone upgraded over the top of them.  But fail with an error if you uninstall or install fresh with a modern setup.  Often because of backend database upgrades.

good luck....

Thanks for your guys responses. I did that and tried to activate a plugin I knew was causing a issue and this was the error I got.
SQL Error: 1062 - Duplicate entry '1' for key 'PRIMARY'

Query: INSERT INTO mybb_mytabs_settings (id,name,value) VALUES (1,'enabled','1'), (2,'default_tab_html','<a href="{$link}" style="margin-right: 6px;"> <div style="display: inline-block; padding: 10px; border: 1px solid #858787; color: black; background-color: #BABCBC;"> {$name} </div></a>'), (3,'default_selected_tab_html','<a href="{$link}" style="margin-right: 6px;"> <div style="display: inline-block; padding: 10px; border: 1px solid #49B0D8; color: black; background-color: #8CDEFF;"> {$name} </div></a>'), (4,'tab_list_html','<div class="trow2" style="border: 1px solid #ccc; margin: 0px 2px 20px 2px; padding: 10px;"> {$tablist}</div>'), (5,'default_tab','1'), (6,'ajax','0'
Okay, so that seems to be that the plugin has already been installed once before but it wasn't fully uninstalled, so now it's trying to create things that are already there.

If you run this query:

DROP TABLE `mybb_mytabs_settings`;

in phpMyAdmin, then try and install the plugin again, it should work. However, you may get further errors if there's other tables that already exist.
(2021-08-08, 07:58 PM)Matt Wrote: [ -> ]Okay, so that seems to be that the plugin has already been installed once before but it wasn't fully uninstalled, so now it's trying to create things that are already there.

If you run this query:

DROP TABLE `mybb_mytabs_settings`;

in phpMyAdmin, then try and install the plugin again, it should work. However, you may get further errors if there's other tables that already exist.

Thanks again for you help, Matt.

So this is what I did. Whenever my forum started messing up the first time, I tried everything to get back up and running but nothing worked out. My host didn't help me much either. So, foolishly, I just deleted everything from my htdocs, added the whole setup of MyBB back to it and reinstalled it. You saying that definitely lets me know I should had made a new database or something, right?
I'm not gonna lie, I have no idea how to use phpMyAdmin. I really wish I did but trying to read and watch YouTube instructions about it just literally makes zero sense to me, lol. MyBB seemed so easier to use back in the day. I understand they're making things a little more advance so not just anyone can make a forum.

Not trying to rant about it though, lol. I just wish this never happened to begin with like it did.

---------------
EDIT:

So I don't know why I was having trouble with phpMyAdmin beforehand but now I got the hang of it.
Your solution fixed my issue, Matt! Thank you again, very greatly! Sorry for my lack of knowledge sometimes, lol Huh
Glad it worked Smile

I'm not sure what issues you had before, but depending on what it was it could potentially have been sorted. Usually unless the data in the database itself is corrupted or incomplete, then any other errors are just a case of fixing what's actually going wrong in that moment. One of those things to learn from I guess.