ʵÏÖwin2003ÏÂmysqlÊý¾Ý¿âÿÌì×Ô¶¯±¸·Ý
ÖÕÓÚÈ÷þÎñÆ÷ÿÌìÔçÉϱ¸·ÝÒ»´Î MySQL Êý¾Ý¿â²¢×Ô¶¯´ò°ü,ͬʱɾ³ý 5 ÌìÇ°µÄ±¸·ÝÎļþ. ·ÖÏíÈçÏÂ.
1. »·¾³: windows server 2003 + Apache 2.0 + PHP5 + MySQL 4.0.26 .
2. ¼ÙÉè PHP °²×°Ä¿Â¼Îª D:/php ,MySQL °²×°Ä¿Â¼Îª D:/mysql.
3. ÔÚ D:/php Ͻ¨Á¢Ä¿Â¼ WinRAR, °ÑÄã winrar °²×°Ä¿Â¼Ï嵀 WinRAR.exe ºÍ RARReg.KEY ¸´ÖƵ½ D:/php/WinRAR .
4. D:/php Ͻ¨Á¢Îļþ mysql_backup.php:
/*/////////////////////////
#FileName: mysql_backup.php
#Author: faisun
#Website: http://www.softpure.com
////////////////////////*/
//±£´æĿ¼,·¾¶ÒªÓ÷´Ð±¸Ü.ÄúÐèÒªÊÖ¶¯½¨Á¢Ëü.
$store_folder = 'D:databse_backup'; //Óû§ÃûºÍÃÜÂë
//¸ÃÕʺÅÐëÓвÙ×÷[ËùÓÐ]µÄÊý¾Ý¿â¼°FILEµÄȨÏÞ
//·ñÔòÓÐЩÊý¾Ý¿â²»Äܱ¸·Ý.
$db_username = "root";
$db_password = ""; $time=time(); $nowdir = "$store_folder".date("Ymd",$time)."";
if(file_exists("$nowdir.rar")) die("File exists.n");
@mkdir($nowdir); mysql_connect("localhost","$db_username","$db_password");
$query=mysql_list_dbs(); while($result=mysql_fetch_array($query)){
system (dirname(__FILE__).'..mysqlbinmysqldump --opt '."$result[Database] -u ".($db_password?"-p":"")." > $nowdir$result[Database].sql");
echo "dumping database `$result[Database]`...n";
}
echo "nWinrar loading...n"; system( dirname(__FILE__)."WinRARWinRAR.exe a -ep1 -r -o+ -m5 -df "$nowdir.rar" "$nowdir" " ); //ɾ³ý 5 ÌìÇ°µÄÎļþ
@unlink("$store_folder".date("Ymd",$time-86400*5).".rar"); echo "nOK!n"; >
5. D:/php Ͻ¨Á¢Îļþ mysql_backup.bat,ÄÚÈÝÖ»ÓÐÒ»¾ä:
php.exe mysql_backup.php
6. Ë«»÷¸Ã bat ÎļþÔËÐÐ,Èç¹ûÄܱ¸·ÝÁË,OK,ÏÂÒ»²½Ìí¼ÓÈÎÎñ¼Æ»®.
7. °Ñ D:/php/mysql_backup Ìí¼Óµ½ÈÎÎñ¼Æ»®,ʱ¼äѡÿÌì. ¸ù¾Ý·þÎñÆ÷µÄ¼à²â½á¹û,ÿÌìÔçÉÏ 5-8 ʱΪÁ÷Á¿µÍ·åÆÚ. ÓÉÓÚ 5-7 ʱÓÐЩÊý¾Ý¿âµÄÇåÀí¹¤×÷,ÎÒ°Ñʱ¼ä¶¨ÔÚÁËÔçÉÏ 8 µãÕû.
Ïà¹ØÎĵµ£º
apacheµÄ¾²Ì¬/¶¯Ì¬±àÒëÔÚapache+php+mysqlµÄÓ¦ÓÃ
ÎÒÏë´ó¼ÒÓв»ÉÙ¶¼³É¹¦ÊµÏÖapache+php+mysql£¬ÍøÉϵÄÎÄÕÂÒ²Óв»ÉÙ£¬µ«ÎÒ·¢ÏÖ²»ÉÙÎÄÕ¶¼ÊdzÀ´³È¥£¬²¢ÇÒ
ûÓÐ˵Ã÷°×±àÒëµÄ·½Ê½£¬ÓеÄË÷ÐÔapache1.3µÄ±àÒë·½·¨Ô·â²»¶¯µÄ°á¹ýÀ´Ì×ÔÚapache2.0£¬ÏÔÈ»Îóµ¼Ò»Ð©²ËÄñ £¡
ÎÒ½ñÌì¾ÍÒÔapache+mysql+php˵һϾ²Ì¬±àÒëºÍDSO¶¯Ì¬±à ......
Ïêϸ½âÊͺÍÀý×Ó¼ûÏÂÁÐÎÄÕ£º
http://www.mysqlperformanceblog.com/2008/09/03/analyze-myisam-vs-innodb/
http://www.penglixun.com/work/database/mysql_show_index_cardinality.html
£¨1£©cardinalityÓ°Ïìmysql optimizer¶ÔË÷ÒýµÄÑ¡È¡
£¨2£©¿ÉÒÔͨ¹ýshow index from table_nameÀ´²é¿´±íµÄË÷ÒýºÍcardinality
£¨3£©in ......
¿ÉÒԲο¼ÏÂÁÐÎÄÕÂ
http://www.mysqlperformanceblog.com/2010/03/23/too-many-connections-no-problem/
½áÂÛÈçÏ£º
£¨1£©mysqlĬÈÏ»á¸øsuperÓû§ÁôÒ»¸öÁ¬½Ó£¬Äã¿ÉÒÔÓÃÕâ¸öÔ¤ÁôµÄÁ¬½ÓÀ´µÇ¼£¬À´Ôö¼ÓÁ¬½ÓÊý£»µ«ÊÇÈç¹ûÁ¬½ÓµÄÓû§È«ÊÇsuperȨÏ޵ģ¬ÔòÕâ¸öÔ¤ÁôµÄÁ¬½Ó²»´æÔÚ¡£Õâʱ¿ÉÒÔÓÃÒÔϵÄÃüÁîÀ´ÉèÖÃÁ¬½ÓÊý£ºgdb -p $(cat ......
ÕâÁ½ÌìÕýÔÚ²âMYSQLµÄÐÔÄÜ£¬°´ÕÕMYSQLÎĵµÖÐÍƼöµÄÉèÖã¬ÐÞ¸ÄÁ˼¸¸öϵͳ±äÁ¿
innodb_buffer_pool_size=1G
innodb_log_file_size=250M
innodb_log_buffer_size=8M
½á¹ûMYSQL±ÀÁË¡£mysql¿Í»§¶ËÄܵǼ£¬µ«Ö»ÒªÖ´ÐÐÈκÎÃüÁmysqldÁ¢¿Ì±Àµô¡£
¿ªÊ¼»¹ÒÔΪÊÇinnodb_buffer_pool_sizeµÈ¼¸¸ö²ÎÊýÉèµÃÌ«´óÁË£¬¿ÉÊǵ÷ÕûÁ˼¸´Î¶ ......
MySQLµÄ×Ö·û¼¯ÎÊÌâ¡£WindowsÏ¿Éͨ¹ýÐÞ¸Ämy.iniÄÚµÄ
CODE:
# CLIENT SECTION
[mysql]
default-character-set=utf8
#
SERVER SECTION
[mysqld]
default-character-set=utf8
Õâ
Á½¸ö×Ö¶ÎÀ´¸ü¸ÄÊý¾Ý¿â
µÄ
ĬÈÏ×Ö·û¼¯¡£µÚÒ»¸öÊÇ¿Í»§¶ËĬÈϵÄ×Ö·û¼¯£¬µÚ¶þ¸öÊÇ·þÎñÆ÷¶ËĬÈϵÄ×Ö·û¼¯¡£¼ÙÉèÎÒÃÇ°ÑÁ½¸ö¶¼ÉèΪutf8£¬È»ºó ......