MySql Êý¾ÝÀàÐÍ´óÈ«
MySQLÖ§³Ö´óÁ¿µÄÁÐÀàÐÍ£¬Ëü¿ÉÒÔ±»·ÖΪ3ÀࣺÊý×ÖÀàÐÍ¡¢ÈÕÆÚºÍʱ¼äÀàÐÍÒÔ¼°×Ö·û´®(×Ö·û)ÀàÐÍ¡£±¾½ÚÊ×Ïȸø³ö¿ÉÓÃÀàÐ͵ÄÒ»¸ö¸ÅÊö£¬²¢ÇÒ×ܽáÿ¸öÁÐÀàÐ͵Ĵ洢ÐèÇó£¬È»ºóÌṩÿ¸öÀàÖеÄÀàÐÍÐÔÖʵĸüÏêϸµÄÃèÊö¡£¸ÅÊöÓÐÒâ¼ò»¯£¬¸üÏêϸµÄ˵Ã÷Ó¦¸Ã¿¼Âǵ½ÓйØÌض¨ÁÐÀàÐ͵ĸ½¼ÓÐÅÏ¢£¬ÀýÈçÄãÄÜΪÆäÖ¸¶¨ÖµµÄÔÊÐí¸ñʽ¡£
ÓÉMySQLÖ§³ÖµÄÁÐÀàÐÍÁÐÔÚÏÂÃæ¡£ÏÂÁдúÂë×ÖĸÓÃÓÚÃèÊöÖУº
M
Ö¸³ö×î´óµÄÏÔʾ³ß´ç¡£×î´óµÄºÏ·¨µÄÏÔʾ³ß´çÊÇ 255 ¡£
D
ÊÊÓÃÓÚ¸¡µãÀàÐͲ¢ÇÒÖ¸³ö¸úËæÔÚÊ®½øÖÆСÊýµãºóµÄÊýÂëµÄÊýÁ¿¡£×î´ó¿ÉÄܵÄÖµÊÇ30£¬µ«ÊÇÓ¦¸Ã²»´óÓÚM-2¡£
·½À¨ºÅ(“[”ºÍ“]”)Ö¸³ö¿ÉÑ¡µÄÀàÐÍÐÞÊηûµÄ²¿·Ö¡£
×¢Ò⣬Èç¹ûÄãÖ¸¶¨Ò»¸öÁËΪZEROFILL£¬MySQL½«Îª¸ÃÁÐ×Ô¶¯µØÔö¼ÓUNSIGNEDÊôÐÔ¡£
TINYINT[(M)]
[UNSIGNED] [ZEROFILL]
Ò»¸öºÜСµÄÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-128µ½127£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½255¡£
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-32768µ½32767£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½65535¡£
MEDIUMINT[(M)] [UNSIGNED]
[ZEROFILL]
Ò»¸öÖеȴóСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-8388608µ½8388607£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½16777215¡£
INT[(M)] [UNSIGNED] [ZEROFILL]
Ò»¸öÕý³£´óСÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-2147483648µ½2147483647£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½4294967295¡£
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
ÕâÊÇINTµÄÒ»¸öͬÒå´Ê¡£
BIGINT[(M)]
[UNSIGNED] [ZEROFILL]
Ò»¸ö´óÕûÊý¡£ÓзûºÅµÄ·¶Î§ÊÇ-9223372036854775808µ½9223372036854775807£¬ÎÞ·ûºÅµÄ·¶Î§ÊÇ0µ½
18446744073709551615¡£×¢Ò⣬ËùÓÐËãÊõÔËËãÓÃÓзûºÅµÄBIGINT»òDOUBLEÖµÍê³É£¬Òò´ËÄã²»Ó¦¸ÃʹÓôóÓÚ9223372036854775807£¨63λ)µÄÓзûºÅ´óÕûÊý£¬³ýÁËλº¯Êý£¡×¢Ò⣬µ±Á½¸ö²ÎÊýÊÇINTEGERֵʱ£¬-¡¢+ºÍ*½«Ê¹ÓÃBIGINTÔËË㣡ÕâÒâζ×ÅÈç¹ûÄã³Ë2¸ö´óÕûÊý(»òÀ´×ÔÓÚ·µ»ØÕûÊýµÄº¯Êý)£¬Èç¹û½á¹û´óÓÚ9223372036854775807£¬Äã¿ÉÒԵõ½ÒâÍâµÄ½á¹û¡£Ò»¸ö¸¡µãÊý×Ö£¬²»ÄÜÊÇÎÞ·ûºÅµÄ£¬¶ÔÒ»¸öµ¥¾«¶È¸¡µãÊý£¬Æ侫¶È¿ÉÒÔÊÇ<=24£¬¶ÔÒ»¸öË«¾«¶È¸¡µãÊý£¬ÊÇÔÚ25
ºÍ53Ö®¼ä£¬ÕâЩÀàÐÍÈçFLOATºÍDOUBLEÀàÐÍÂíÉÏÔÚÏÂÃæÃèÊö¡£FLOAT(X)ÓжÔÓ¦µÄFLOATºÍDOUBLEÏàͬµÄ·¶Î§£¬µ«ÊÇÏÔʾ³ß´çºÍСÊýλÊýÊÇ䶨ÒåµÄ¡£ÔÚMySQL3.23ÖУ¬ÕâÊÇÒ»¸öÕæÕýµÄ¸¡µãÖµ¡£ÔÚ¸üÔçµÄMySQL°æ±¾ÖУ¬FLOAT(precision)×ÜÊÇÓÐ2λСÊý¡£¸Ã¾ä·¨ÎªÁËODBC¼æÈÝÐÔ¶øÌṩ¡£
FLOAT[(M,D)] [ZEROFILL]
Ò»¸öС(µ¥¾«ÃÜ)¸¡µãÊý×Ö¡£²»ÄÜÎÞ·ûº
Ïà¹ØÎĵµ£º
ÔÚѧϰ£¼Linux³ÌÐòÉè¼Æ£¾µÚ8ÕÂMySQLÊý¾Ý¿â8.3½Ú£º
ʹÓÃCÓïÑÔ·ÃÎÊMySQL·ÃÎÊÊý¾Ý¿âʱ³¢ÊÔ°ÑSQLÊý¾Ý»»³ÉÁËÖÐÎÄ£¬µ«ÊÇÔÚÔËÐÐʾÀý³ÌÐòʱÖÕ¶ËÊä³öÈ´ÂÒÂ룬MySQL C ÓïÑÔÁ¬½ÓĬÈÏ×Ö·û¼¯ÊÇlatin1
²éÁËÏÂAPIÕÒµ½ÈçϺ¯Êý¿É½â¾öÖÐÎÄÂÒÂëÎÊÌâ¡£
int
mysql_set_character_set(
MYSQL *
mysql,
char
*
csname)
ÃèÊö
¸Ãº¯ÊýÓ ......
1.SELECT USER();
»ñµÃµ±Ç°µÇ½Óû§µÄÓû§ÃûÓëÖ÷»úÐÅÏ¢£¬Ê¹ÓøÃÃüÁî»áÏÔʾÀàËÆÓÚÈçÏÂÐÅÏ¢£ºroot@zxj.lest.vicp.cc£¬@Ç°ÃæÊÇÓû§Ãû£¬ºóÃæÊÇÖ÷»úÃû¡£
2.SHOWÓ÷¨£¬
SHOW DATABASES--ÏÔʾ¶àÉÙ¸öÊý¾Ý¿â£¬Ò²¿ÉÒÔ½Ð×ö±í¿Õ¼ä¡£
SHOW TABLES--ÏÔʾÓжàÉÙ¸ö±í¡£
SHOW VARIABLES--ÏÔʾÊý¾Ý¿â±äÁ¿¡£
SHOW MASTER STATUS.
SHOW C ......
×÷Õߣº°½Ê¿Î°
Mysql ÓõÄÊÇLinux (non RPM packages)
Ò»¡¢½«mysql-5.5.0-m2-linux-i686-glibc23.tar.gzÏÂÔص½/home/ikmb ²¢ÔÚµ±Ç°Ä¿Â¼½âѹ£»
……..
mysql-5.5.0-m2-linux-i686-glibc23/data/mysql/
mysql-5.5.0-m2-linux-i686-glibc23/data/test/
…………
& ......
phpmyadmin2.11.92 --APMSEVR5.2.6
д´æ´¢¹ý³ÌʱÌáʾerror 1307 (HY000):Failed to create procedure...
-----------------------------------------------------------------------
½«phpmyadminÖеÄmysqlÊý¾Ý¿âÖеıíprocɾ³ý
Ö´ÐÐÒÔÏ´úÂëÖؽ¨¸Ã±í
-------------------------------------------------------------- ......
TO_DAYS(date) //¸ø¶¨Ò»¸öÈÕÆÚ£¬·µ»Ø´Ó0Ä꿪ʼµÄÌìÊý¡£
from_DAYS(N) //¸ø¶¨Ò»¸öÌìÊý£¬·µ»ØÒ»¸öÈÕÆÚ¡£
È磺
select TO_DAYS('1997-10-7') //·µ»Ø729669
select from_DAYS(729669) //·µ»Ø1997-10-7
UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)
ÈôÎÞ²ÎÊýµ÷Óã¬Ôò·µ ......