ʵÏÖ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 µãÕû.
Ïà¹ØÎĵµ£º
½â¾öThe‘InnoDB’feature is disabled; you need MySQL built with ‘InnoDB’ to have it2009Äê12ÔÂ29ÈÕ ÐÇÆÚ¶þ ÉÏÎç 11:15MySQL
³öÏÖÈçÏÂÓï¾ä£ºThe ‘InnoDB’ feature is disabled; you need MySQL built with ‘InnoDB’ to have it working£»
ÊÇmysqlÅäÖÃÎļþ½ûµôÁËÕâ¸öÑ¡ ......
MySQL showµÄÓ÷¨
a. show tables»òshow tables from database_name; // ÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ
b. show databases; // ÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ
c. show columns from table_name from database_name; »òshow columns from database_name.table_name; ......
EXPLAIN ÊÇmysql½âÊÍselect²éѯµÄÒ»¸ö¹Ø¼ü×Ö,¿ÉÒԺܷ½±ãµÄÓÃÓÚµ÷ÊÔ
Óï·¨¸ñʽÈçÏÂ
EXPLAIN tbl_name
»òÕß:
EXPLAIN SELECT select_options
EXPLAIN Óï¾ä¿ÉÒÔ±»µ±×÷ DESCRIBE µÄͬÒå´ÊÀ´Óã¬Ò²¿ÉÒÔÓÃÀ´»ñÈ¡Ò»¸öMySQLÒªÖ´ÐÐµÄ SELECT Óï¾äµÄÏà¹ØÐÅÏ¢¡£
EXPLAIN tbl_name Óï·¨ºÍ DESCRIBE tbl_name »ò SHOW COLUMNS ......
Èç¹ûÒªÁ˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ£¬Ê×ÏÈÁ˽âÒ»ÏÂMySQLµÄÈýÖÖËø¶¨ÀàÐÍ£º
Ò»£¬Ðм¶Ëø¶¨
¶þ£¬±í¼¶Ëø¶¨
Èý£¬Ò³¼¶Ëø¶¨
ÕâÈýÖÖËø¶¨ÀàÐÍ£¬ÔÚMySQLÊý¾Ý¿âÖÐʹÓÃÈçÏ£º
Ðм¶Ëø¶¨£ºMyISAM£¬Memory£¬CSV[·ÇÊÂÎñÐԵĴ洢ÒýÇæ]
±í¼¶Ëø¶¨£ºInnoDB£¬NDB Chuster
Ò³¼¶Ëø¶¨£ºBerkeley DB
Á½ÖÖËø¶¨»úÖÆ£º¶ÁËø¶¨ºÍдËø¶¨
MySQLÊý¾Ý¿âËø¶ ......
ÔÚmysqlÖÐÀûÓÃselectÓï¾äµÄÒ»¸öÌØÐԾͿÉÒԺܷ½±ãµØʵÏÖ²éѯ½á¹ûµÄ·ÖÒ³£¬selectÓï¾äµÄÓï·¨£º
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [HIGH_PRIORITY]
[DISTINCT | DISTINCTROW | ALL]
select_expression,...
[INTO OUTFILE 'file_name'&nb ......