1¡¢ÓÃmysqlÄÚÖú¯Êýת»»ipµØÖ·ºÍÊý×Ö
ÀûÓÃÁ½¸öÄÚÖú¯Êý
[code]inet_aton:½«ipµØַת»»³ÉÊý×ÖÐÍ
inet_ntoa:½«Êý×ÖÐÍת»»³ÉipµØÖ·[/code]
2¡¢³ä·ÖÀûÓÃmysqlÄÚÖõÄformatº¯Êý
ÓÈÆäÊÇÔÚ´¦Àí×Ö·û¸ñʽµÄʱºò,ÀýÈ罫12345ת»»³É12,345ÕâÑùµÄ,Ö»ÒªÓÃ:format(12345,0)¼´¿É,Èç¹ûÓÃformat(12345,2)ÔòÏÔʾµÄÊÇ12,345.00ÁË...
3¡¢ÀûÓÃmysqlµÄÄÚÖú¯Êý´¦Àíʱ¼ä´ÁÎÊÌâ
[code]eg : select FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y %D %M %h:%i:%s %x');
½á¹û: 2004 3rd August 03:35:48 2004[/code]
4¡¢ÀûÓÃmysql_convert_table_formatת»»±íÀàÐÍ
ÐèÒªDBIºÍDBDµÄmysqlÏà¹ØÄ£¿éÖ§³Ö²ÅÄÜÓÃ,Àý×Ó:
[code]mysql_convert_table_format --user=root --password='xx' --type=myisam test yejr[/code]
5¡¢ÐÞ¸Ämysql±íÖеÄ×Ö¶ÎÃû
[code]alter table tb_name change old_col new_col definition...[/code]
6¡¢ÀûÓÃÁÙʱ±äÁ¿
[code]select @var1:=a1+a2 as a_sum,@var2:=b1+b2 as b_sum,@var1+@var2 as total_sum from test_table xxx;[/code]
7¡¢ÓÃintÀàÐÍ´æ´¢ipµØÖ·
ÔÏÈ´íÎóµÄÈÏΪ±ØÐëÓÃbigint²Å¹»£¬ºóÀ´·¢ÏÖʹÓÃint unsignedÀàÐ;Í×ã¹»ÁË¡£ :)
8¡¢CREATE TABLE IF NOT EXISTS ... select Óï·¨¾ÖÏÞ
¾¡¹ÜÖ»ÊǶÔÄ¿±ê±íµÄinsert²Ù×÷£¬µ«ÊÇ¡®¾ÓÈ»¡¯²»ÔÊÐíÔ´±íµÄinsert²Ù×÷£¬ÕæÊÇĪÃûÆäÃî
9¡¢ÀûÓÃIFº¯Êý¿ìËÙÐÞ¸ÄENUM×Ö¶ÎÖµ
Ò»¸öÀý×Ó£º
[code]update rule set enable = if('0' = enable,'1','0') where xxx;
enable ÀàÐÍ£ºenum('0','1') not null default '0'[/code]
10¡¢ÊÂÎñÎÞ·¨Ç¶Ì×
11¡¢±ÜÃⳤʱ¼äµÄsleepÁ¬½ÓÔì³ÉµÄÁ¬½ÓÊý³¬³öÎÊÌâ
É趨ȫ¾Ö±äÁ¿ wait_timeout ºÍ interactive_timeout Ϊ±È½ÏСµÄÖµ£¬ÀýÈç 10(s)£¬¾ÍÄÜʹÿ¸ösleepÁ¬½ÓÔÚ10sÖ®ºóÈç¹û»¹Ã»ÓвéѯµÄ»°×Ô¶¯¶Ï¿ª¡£