XF 1.5 Server Error: Mysqli prepare error

Drew

Member
All of a sudden we are having this error:

Server Error
Mysqli prepare error: INSERT command denied to user 'zendart'@'184.168.46.70' for table 'xf_session'

  1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
  2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
  3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
  4. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  5. Zend_Db_Adapter_Abstract->insert() in XenForo/Session.php at line 855
  6. XenForo_Session->saveSessionToSource() in XenForo/Session.php at line 573
  7. XenForo_Session->save() in XenForo/Controller.php at line 414
  8. XenForo_Controller->updateSession() in XenForo/Controller.php at line 358
  9. XenForo_Controller->postDispatch() in XenForo/FrontController.php at line 358
  10. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  11. XenForo_FrontController->run() in /home/content/33/8436533/html/index.php at line 13
Anyone able to give me some insight on this?
 
What plugins do you use, it could be one of them is really abusing session

Since nobody can log in and the forum is currently dead, I can't see an issue of clearing this table
- do a backup anyway (I don't know why at the moment, but I never clear anything without making a backup)

- actually, I can already think of one good reason to back this table up, just to figure out why it went wrong
 
Last edited:
You can clear the table, though it really shouldn't get that large as it's pruned regularly normally via a cron task.

Once you get back in, are there errors logged in the control panel?
 
unix tamp stamp, it's always the case (seconds since 1 jan 1970)

It's a db standard, good for universal time (lots of different countries with various time formats use xenforo)

http://www.unixtimestamp.com/

hang on, I'm going to check my session table and make sure that's what it is

yep, that's as expected: .... although, it should be 10 digits
 

Attachments

  • Untitled.webp
    Untitled.webp
    49.6 KB · Views: 4
Last edited:
I'm getting the same error(s) I cleared the table and still getting the same thing, strange thing is when I try to restore my database it says Unsuccessful, tried it 3 times.... Any suggestions....?????
Server Error
Mysqli prepare error: INSERT command denied to user 'friedravioli'@'97.74.215.40' for table 'xf_session_admin'

  1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
  2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
  3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
  4. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  5. Zend_Db_Adapter_Abstract->insert() in XenForo/Session.php at line 784
  6. XenForo_Session->saveSessionToSource() in XenForo/Session.php at line 518
  7. XenForo_Session->save() in XenForo/Controller.php at line 412
  8. XenForo_Controller->updateSession() in XenForo/Controller.php at line 356
  9. XenForo_Controller->postDispatch() in XenForo/FrontController.php at line 354
  10. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  11. XenForo_FrontController->run() in /home/content/r/i/c/richardsoccer/html/soccer/admin.php at line 13
 
This error is due to a lack of permissions for the MySQL user in question. I don't see why it would suddenly change though, unless this is something your host did. If you have cPanel, I believe you can change the privileges from there, though I'm never actually tried to do that. (You can set the privileges when you create the user.) XenForo would generally expect "all privileges". Given that it seems to have spontaneously happened though, you may want to check with your host. They may also be able to help adjust the permission for the MySQL user listed.
 
Mike, it's exactly the same error he was getting before (which still could be db user permission), but is xf_session is now definitely cleared?

It could still be that the db file size is too large, I know with oracle, the files that make up the tables can grow massively and don't necessarily dynamically shrink on deleting certain db content, I wonder if mySQL has a similar issue.

And why would godaddy say you have too many tables, that's a strange limit (surely they mean rows/data)

strange thing is when I try to restore my database it says Unsuccessful, tried it 3 times.... Any suggestions....?????

What do you mean by this, I thought you was going to clear that table, why would you need to have "restored" the database and where does it say "Unsuccessful"
What did you use to clear the table, and are you sure the sql was commit after running (was the table really clear if you logged out and logged back in).
Are there any limits you've hit when you log into CPanel (assuming you are using CPanel)

upload_2017-2-16_10-53-58.webp


While there, look at your db users permissions: under MySQL DataBases >> Click the db user
It should look like:

upload_2017-2-16_11-2-44.webp
 
Mike, it's exactly the same error he was getting before (which still could be db user permission), but is xf_session is now definitely cleared?

It could still be that the db file size is too large, I know with oracle, the files that make up the tables can grow massively and don't necessarily dynamically shrink on deleting certain db content, I wonder if mySQL has a similar issue.

And why would godaddy say you have too many tables, that's a strange limit (surely they mean rows/data)



What do you mean by this, I thought you was going to clear that table, why would you need to have "restored" the database and where does it say "Unsuccessful"
What did you use to clear the table, and are you sure the sql was commit after running (was the table really clear if you logged out and logged back in).
Are there any limits you've hit when you log into CPanel (assuming you are using CPanel)

View attachment 148346


While there, look at your db users permissions: under MySQL DataBases >> Click the db user
It should look like:

View attachment 148347
I cleared the table but made a back up too, tried to go back to the original. Regardless, clearing the table worked, Guess it took a while to update. Thanks for the info you rock & the help is greatly appreciated. Thanks again!
 
You still need to figure out why this happened, otherwise it will happen again.

As Mike mentioned, there should be a cron entry to clear this table, when will it next be due to run, and does it run correctly when you force it to run now:

Tools >> Cron Entries >> hourlyCleanUp

And are there any errors in your server error logs
yoursite/admin.php?logs/server-error

The hourly clean up has both:
Code:
$sessionModel->deleteSessionActivityOlderThanCutOff($sessionCleanUpCutOff);
$session->deleteExpiredSessions();

So if you log in and out with a different user, are they removed from this table after running (does the number of rows reduce at all, or is it still growing)

Its quite possible you accidentally unticked this:

upload_2017-2-16_18-2-44.webp
 
Last edited:
You still need to figure out why this happened, otherwise it will happen again.

As Mike mentioned, there should be a cron entry to clear this table, when will it next be due to run, and does it run correctly when you force it to run now:

Tools >> Cron Entries >> hourlyCleanUp

And are there any errors in your server error logs
yoursite/admin.php?logs/server-error

The hourly clean up has both:
Code:
$sessionModel->deleteSessionActivityOlderThanCutOff($sessionCleanUpCutOff);
$session->deleteExpiredSessions();

So if you log in and out with a different user, are they removed from this table after running (does the number of rows reduce at all, or is it still growing)

Its quite possible you accidentally unticked this:

View attachment 148383
Back to the same error, I emptied that table again and still nothing. So I can't log in to do the Cron/clean up thing. I don't know what I did yesterday that got it back up. Ugggh
Server Error
Mysqli prepare error: INSERT command denied to user 'friedravioli'@'97.74.215.40' for table 'xf_session'
 
Back
Top Bottom