Why is that?
- They like to keep you at your limit (usually 75K Queries per hour, or worse 50K)
- They’ll charge you $ if you want to increase that to 150K (per month for that matter)
- This solution actually gives you the equivalent of 225K per hour (that is a shit load!)
and best of all, YOUR IN CONTROL
What is this exactly?
Good Question, it is a way to swap user logins when you exceed the 75K queries (automatically behind the scenes – set it and forget it), thus enabling your site to keep functioning rather than getting that nasty error codes (500, or ‘exceeded max_questions’ or database can not connect) when you’ve used too man database resources. It is called a 3 User Array (for inquiring minds)
How does it work?
Instead of the default of 1 login (in your config.php file), it can choose between 3 (or more if you’d like)
Will it get me in trouble?
Not sure, but so far so good!
What should I be aware of?
All 3 database logins must use the same password, or it won’t work
How do I start?
- Log into your SQL Database menu located usually in your account on your ISP
- Create 2 more logins using the same password first!
- write each down, the login names and the 1 password
Please make a backup copy of your config.php file first – just in case – for some reason it doesn’t work or the server has some sort of restriction…….do it now!
Please note: that the script was pulled from advisor code sites after a rather extensive search. I did try 4 variations that were reported, but this version was the only working one (that truly worked). Do not email me on coding advice as I would be able to help you on this one.
The portion that says “DB_USER“, may be listed differently in your WordPress config.php file, if so then use their term
OK get started!
1- open your config.php file and edit in text editor
2- Scroll down to the spot that says:
3- now paste in this right below it so it looks like this: (should also be right “above” the “define(‘DB_PASSWORD’,” code)
/** MySQL database username */
//Add as many users as you like
$database_user_array = “username 1 goes here”;
$database_user_array = “username 2 goes here”;
$database_user_array = “username 3 goes here”;
$database_user = $database_user_array[ rand( 0, ( sizeof($database_user_array) -1 ) ) ];
4- Make sure you of course swapped out the parts that say:
username 1 goes here
username 2 goes here
username 3 goes here
with the correct names from your database details
5- SAVE and RE-upload to root
That’s it – now test and enjoy your freedom!
Please note- you should still take actions to keep your site manageable and optimized to prevent ever getting past your limit. In the end, its a solution to a faster site