View Single Post
  #8  
Old 03-30-2009, 09:39 AM
Frondy's Avatar
Frondy Frondy is offline
 
Join Date: Feb 2009
Location: Zagreb, Croatia
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
1. Create additional user(s)
Create more MySQL user/password's and give these full permissions to your database.

2. Edit you config.php, and locate the following lines (they should alerady contain the user/password for your current setup):

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'] = 'root';
$config['MasterServer']['password'] = ''
After the first 3 comment lines, add the following:

PHP Code:
$dbusers = array(
array(
'user' => 'mysql_username_1''password' => 'mysql_password_1'// First MySQL user/password combination
, array('user' => 'mysql_username_2''password' => 'mysql_password_2'// Second MySQL user/password combination
, array('user' => 'mysql_username_3''password' => 'mysql_password_3'// Third MySQL user/password combination
);
$mysql_user $dbusers[rand(0count($dbusers) - 1)]; 
Edit mysql_username_X and mysql_password_X to have valid MySQL username/password combinations. If you need more then 3 combination, just duplicate the third line. If you are only using 2 combinations, remove the third combination.

3. Now edit the lines that configure your username password (they will probably already contain the info for the first MySQL user).
find:

PHP Code:
$config['MasterServer']['username'] = 'root';
$config['MasterServer']['password'] = ''
and replace them with:

PHP Code:
$config['MasterServer']['username'] = $mysql_user['user'];
$config['MasterServer']['password'] = $mysql_user['password']; 
4. Check your edits, the complete block should look something like:

PHP Code:
 // ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dbusers = array(
array(
'user' => 'mysql_username_1''password' => 'mysql_password_1'// First MySQL user/password combination
, array('user' => 'mysql_username_2''password' => 'mysql_password_2'// Second MySQL user/password combination
, array('user' => 'mysql_username_3''password' => 'mysql_password_3'// Third MySQL user/password combination
);
$mysql_user $dbusers[rand(0count($dbusers) - 1)];
$config['MasterServer']['username'] = $mysql_user['user'];
$config['MasterServer']['password'] = $mysql_user['password']; 
5. Save and upload your config.php. Finished.

Everytime a page is opened, 1 of the defined username/password combinations will be choosen at random, and by this reducing the number of connections for each user.
I found this quoted article on vb.com site, is it the same purpose variant? ('max_user_connections' issue)


.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01097 seconds
  • Memory Usage 1,802KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete