mysql Ë÷Òý
1
Ë÷ÒýµÄÒâÒ壺
Óŵ㣺
Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌض¨ÖµµÄ¼Ç¼£¬Èç¹ûûÓÐË÷Òý£¬Ö´Ðвéѯʱ±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨Ãè±íÖÐËùÓмǼ£¬±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£
ȱµã£º
Ë÷ÒýÒªÕ¼ÓôÅÅ̿ռ䣻ÇÒÈκÎд²Ù×÷Éæ¼°µÄË÷Òý¸öÊý¶àµÄ»°»áÒýÆð½µËÙ£¬ÒòΪ
MySQL
²»½öÒª°Ñ¸Ä¶¯Êý¾ÝдÈëÊý¾ÝÎļþ£¬¶øÇÒËü»¹Òª°ÑÕâЩ¸Ä¶¯Ð´ÈëË÷ÒýÎļþ¡£
ÒÔϾͶÔË÷Òý£º
Index Test (col1,col2,col3)
½øÐзÖÎö£¬ÈçÓв»×¼È·Ö®´¦£¬»¶Ó´ó¼ÒÅÄש¡£
2
´Ó×óÖÁÓÒµÄÕýÏòË÷ÒýÆ¥Å䣨µÚÒ»ÐÐÊÇË÷Òý¿ÉÓó¡¾°£¬µÚ¶þÐÐÊÇË÷Òý²»¿ÉÓó¡¾°£©
ÓұߵÄÊÊÓÃ
where
col1=$para1;
where
col1=$para1and col2=$para2;
where col1=$para1
and col2=$para2 and col3=$para3;
ÓұߵIJ»ÊÊÓÃ
where
col2=$para2;
where
col1=$para1and col3=$para3;
where col2=$para2
and col3=$para3;
3
like
ÓëË÷ÒýÓÐЧÐԵĹØϵ£¨µÚÒ»ÐÐÊÇË÷Òý¿ÉÓó¡¾°£¬µÚ¶þÐÐÊÇË÷Òý²»¿ÉÓó¡¾°£©
ÓұߵÄÊÊÓÃ
where col1 like
‘aaa%’;
where col1 like
‘aaa%’ and col2 like ‘bbb%’ ;
where col1 like
‘aa%a%’ and col2 like ‘bb%b%’ ;
ÓұߵIJ»ÊÊÓÃ
where col1 like
‘%aaa’; (
ͨÅä·ûÔÚÇ°£¬ÎÞÈ·¶¨·¶Î§
)
where col1 like
‘%aaa’ and col2 like ‘%bbb’ ;
where col1 like
‘%aa%a’ and col2 like ‘%bb%b’
;
4
or
¡¢
and
ÓëË÷ÒýÓÐЧÐԵĹØϵ£¨µÚÒ»ÐÐÊÇË÷Òý¿ÉÓó¡¾°£¬µÚ¶þÐÐÊÇË÷Òý²»¿ÉÓó¡¾°£©
ÓұߵÄÊÊÓÃ
where
col1=$para1and col2=$para2;
where
col1=$para1or col1=$para11; (
ͬһ
column
)
where col1=$para1
or col1=$para11 and col2=$para2;
ÓұߵIJ»ÊÊÓÃ
where
col1=$para1or col2=$para2; (
ÎÞÈ·¶¨·¶Î§
)
where col1 like
‘%aaa’ or col2 like ‘%bbb’ ;
where col1=$para1
or col2=$para2 and
col3=$para3;
5
ÆäËû
mysql
ÄÚÖú¯ÊýÓëË÷ÒýÓÐЧÐԵĹØϵ
(
ÒÔ
col1
¾ÙÀý
)
£¨µÚ¶þÁÐÊÇ¿ÉÓó¡¾°£¬µÚÈýÁÐÊDz»¿ÉÓó¡¾°£©
º¯ÊýÃû
¿ÉÓó¡¾°
²»¿ÉÓó¡¾°
Ìæ´ú°ì·¨
SUBSTRING
--
SUBSTRING
£¨
col1,1,2
£©
²»¿ÉÓ㬲ð·ÖÁË
sq
Ïà¹ØÎĵµ£º
MySQL ÃüÁîÐÐ
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö² ......
http://hi.baidu.com/tianxia_1209/blog/item/a2613822fec7e7f6d6cae267.html
MYSQLµÄʼþÊÇ5.1ÐÂÔö¼ÓµÄ£¬Èç¹ûÏëÌåÑ飬½¨ÒéÉý¼¶°æ±¾¡£
ÖÁÓÚÓï·¨ÎҾͲ»¶à˵ÁË£¬ÊÖ²áÉϽ²µÄºÜÏêϸ£¬ÎÒÀ´ËµËµ¼¸¸öÒªµãÒÔ¼°Ò»Ð©ÊµÀý¡£
×¢ÒâÊÂÏ
1¡¢EVENTȨÏÞÊÇÕë¶ÔģʽµÄ£¨ÔÚMYSQLÖÐÒ²¾ÍÊÇ¿âµÄ¼¶±ð£©£¬²»ÄܶԵ¥¶À±íÀ´¸³ÓèȨÏÞ¡£
2¡¢±ØÐëÔÚ ......
ÔÚÍøÉÏÕÒÁ˺ܶàIIS+PHPµÄÅäÖõķ½·¨£¬ÊÔ¹ýÖ®ºóºÜ¶à¶¼²»ÄܴﵽЧ¹û¡£ÓÚÊÇ×ܽáÁ˴󲿷ֵÄÎÄÕºó¾ÍµÃ³öÁËÕâÑùµÄ·½·¨£º£¨±¾´Î²Ù×÷ϵͳÒÔWin2000ΪÀý£¬Èç¹ûÄãÒª¸ÄΪÆäËüϵͳ¾Í°Ñϵͳ¸ùĿ¼±äһϾÍOkÁË£©
Ò»¡¢ÏÂÔرØÐëµÄ³ÌÐò£º
(1) Ïȵ½PHPµÄ¹Ù·½ÍøÕ¾ÏÂÔØÒ»¸öPHP£¨±¾ÎľÍÒÔPHP 4.4.2ΪÀý£©¡£ ......
1¡¢phpÓëmysql½¨Á¢Á¬½Ó
php.ini ¼ÓÔØmysql×é¼þ
extension=php_mysql.dllÇ°µÄ;È¥µô
exetension_dir=""·¾¶ÊÇ·ñÕýÈ·
PhpÁ¬½Ómysqlº¯Êý
mysql_connect:¿ªÆôMYSQLÁ¬½Ó
mysql_select_dir:´ò¿ªÒ»¸öÊý¾Ý¿â
@ºÍor die Òþ²Ø´íÎóºÍÌõ¼þÏÔʾ
mysql_connect("Ö÷»ú","Óû§Ãû","ÃÜÂë");
mysql_sele ......
show variables like 'character%';²é¿´×Ö·û±àÂë
--¸ü¸Ä×Ö·û¼¯
SET character_set_client = utf-8 ;
SET character_set_connection = utf-8 ;
SET character_set_database = utf-8 ;
SET character_set_results = utf-8 ;
SET character_set_server = utf-8 ;
SET collation_connection = utf8 ;
SET colla ......