Go Back   SZONE.US Forums > Do it yourself (DIY) > Web Tips

Web Tips Tips and tricks specializing in programming languages of the web. ie. PHP, MYSQL, XHTML, CSS, etc

Work Around - Error SQL server exceeded max questions

Views:3320
Reply
Thread Tools Search this Thread Rate Thread
  #1  
Unread 02.09.09, 06:10 PM
Zachariah Boren's Avatar
Zachariah Boren Zachariah Boren is offline
Administrator
 
Join Date: 02.07
Location: Canoga Park, CA
Posts: 928
Blog Entries: 6
Images: 10075
Send a message via ICQ to Zachariah Boren Send a message via MSN to Zachariah Boren Send a message via twitter to Zachariah Boren
Work Around - Error SQL server exceeded max questions

vBulletin: 3.0x / 3.5x / 3.6x / 3.7x / 3.8x

Quote:
"Error: SQL server exceeded 50,000 max questions"
- All mySQL is stopped for like 5 min then all is ok.
- The server it self auto temp bans the mysql account in use.

I am sure others may have ran into this issue. I have ran into many webhosts that because of "server loads" have a cap on max questions mySQL server can be given in a time frame. (1 hour in my case) This becomes a huge problem when doing maintenance of "Update Counters" in the AdminCP.

One workaround is to create multiple mysql users in your hosting account. In config.php you randomly pick one of these users to connect to the database. This will spread the questions between users and since the limit is per user. This is not a perfect solution for if an account maxes out the script will stop, but you can usually overcome the problem.

I set up 7 accounts in mySQL up on 1 database all using the same password.
I ran 236,968 queries without a hiccup.

Edit:
includes/config.php

Find:
PHP Code:
//***** MASTER DATABASE USERNAME & PASSWORD ****** 
//    This is the username and password you use to access MySQL. 
//    These must be obtained through your webhost. 

$config['MasterServer']['username'] = '';
$config['MasterServer']['password'] = ''
Replace with:
PHP Code:
//***** MASTER DATABASE USERNAME & PASSWORD ******
//    This is the username and password you use to access MySQL.
//    These must be obtained through your webhost.
$dblogins = array();

$dblogins['1']['user'] = 'user1';
$dblogins['2']['user'] = 'user2';
$dblogins['3']['user'] = 'user3';
$dblogins['4']['user'] = 'user4';
$dblogins['5']['user'] = 'user5';
$dblogins['6']['user'] = 'user6';
$dblogins['7']['user'] = 'user7';

srand((float) microtime() * 10000000);
$dbloginid array_rand($dblogins);
while (
$dblogins[$dbloginid]['user'] == '')
{
    
$dbloginid array_rand($dblogins);
}
$config['MasterServer']['username'] = $dblogins[$dbloginid]['user'];

unset(
$dblogins$dbloginid);

$config['MasterServer']['password'] = 'password'
1) Make sure and replace user1, user2, user3, user4, user5, user6, user7 with the correct user names made for the database.

2) Also replace password with the correct password.
__________________
http://www.szone.us | http://www.gzhq.net
Twitter | Facebook | My:Hacks @ vBulletin.org
Member of Kiwanis Club of Chatsworth
Reply With Quote
Reply

Tags
error, exceeded, server, sql, work

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PHP] Check your server for GD support Zachariah Boren Web Tips 1 08.31.10 07:12 PM
Multimillion-dollar error found in San Jose pension system Steve Boren News 1 01.13.09 09:24 PM
Americans For Prosperity, Launches Statewide “Already Taxed to the Max” Petition Driv Steve Boren News 0 04.30.08 03:21 PM


All times are GMT -8. The time now is 07:29 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright ©2007 - 20017 SZONE.US All rights reserved