PHP mysqlÊÂÎñ´¦Àí »Ø¹ö²Ù×÷
MYSQLÖÐÖ»ÓÐINNODBºÍBDBÀàÐ͵ÄÊý¾Ý±í²ÅÄÜÖ§³ÖÊÂÎñ´¦Àí£¡ÆäËûµÄÀàÐÍÊDz»Ö§³ÖµÄ£¡
$lnk = mysql_connect("localhost", "root", "");
mysql_select_db("test");
mysql_query("BEGIN");
$query = mysql_query("INSERT INTO test VALUES(1, 'yangjun')");
$q1 = mysql_error();
mysql_query("INSERT INTO test VALUES(1, 'yangjun')");
$q2 = mysql_error();
mysql_query("INSERT INTO test VALUES(2, 'Ñî¿¡')");
$q3 = mysql_error();
if (!$q1 && !$q2 && !$q3) {
mysql_query("COMMIT"); //È«²¿³É¹¦£¬Ìá½»Ö´Ðнá¹û
} else {
mysql_query("ROLLBACK"); //ÓÐÈκδíÎó·¢Éú£¬»Ø¹ö²¢È¡ÏûÖ´Ðнá¹û
}
var_dump($q1, $q2, $q3);
Ïà¹ØÎĵµ£º
QT DataBase SQL Explorer
1¡¢°²×°MySQLµ½¹Ù·½ÍøÕ¾ÏÂÔØMySQLÊý¾Ý¿â£¬·Ç°²×°°æ£¬Ö±½ÓÔËÐÐmysqld½ø³Ìǰ̨µÄ
2¡¢Ìí¼Óϵͳ»·¾³±äÁ¿£¬Path+=':\mysql\bin'µÄpath£¬ÔÙÔÚ¿ªÊ¼ÔËÐУ¬CMD->mysql -uroot µÇ¼µ½mySQLÊý¾Ý¿â
Default passwordûÓеģ¬ÓеĻ° mysql -uroot -pÊäÈëÃÜÂ룻ÍøÂçµÇ¼£ºmysql -h ip ......
PHP½âÒÉ
1. ´úÂëÖØÓ÷½·¨include()ºÍrequire()º¯Êý²îÒ죿
1) Require()º¯Êý
ʹÓÃrequier()°üº¬ÍⲿphpÎļþʱ£¬Ö»Òª×ÔÉíphpÎļþ±»Ö´ÐУ¬ÍⲿÎļþµÄÄÚÈݾͽ«±»°üº¬½ø¸Ã×ÔÉíphpÎļþ£¬µ±°üº¬µÄÍⲿÎļþ·¢Éú´íÎóʱ£¬ÏµÍ³½«¸ø³ö´íÎóÌáʾ£¬²¢ÇÒÍ£Ö¹phpÎļþµÄÖ´ÐС£
ʾÀý£º
µ÷ÓÃÎļþconfig.incµÄ³ÌÐò´úÂ룺
<?php ec ......
Ò»¡¢¿ª·¢³ÉÔ±
a)ÏîÄ¿Ö÷¹Ü
b)Ò³ÃæÃÀ¹¤
c)Ò³Ã濪·¢
d)·þÎñ¶Ë³ÌÐò¿ª·¢
e)ϵͳÓëÊý¾Ý¹ÜÀí
f)²âÊÔÓë°æ±¾¿ØÖÆ
¶þ¡¢ ÍøÕ¾×鿪·¢¼òÃ÷Á÷³Ì
Èý¡¢ ¿ª·¢¹¤¾ßÓë»·¾³
a)·þÎñÆ÷ÅäÖÃ
i. WEB·þÎñÆ÷£º FreeBSD6.1+Apache2.0+PHP5.0£¬SVN°æ±¾¿ØÖÆ·þÎñ(½ö²âÊÔ»ú)¡£
ii.Êý¾Ý¿â·þÎñÆ÷£º WIN2003 server+SQL server 2000+MySQL5.0£¬CLUS ......
±à¼my.cnfÎļþ£¬¼ÓÈ룺
log-slow-queries[=file] #ĬÈÏΪdataĿ¼ÏµÄhostname-slow.logÎļþ
long_query_time=10 (seconds) #Âý²éѯµÄthreshold
log-queries-not-using-indexes #¼Ç¼²»Ê¹ÓÃË÷ÒýµÄ²éѯ
mysqldumpslowÃüÁî»ñµÃÈÕÖ¾ÖÐÏÔʾµÄ²éѯժҪÀ´´¦ÀíÂý²éÑ¯È ......