mysql ÖеÄÊý¾ÝÀàÐÍ
2010-06-01 10:23
Êý¾ÝÀàÐÍ
ÃèÊö
×Ö½Ú
ÍƼöʹÓÃ
SMALLINT
ÕûÊý£¬´Ó-32000µ½ +32000·¶Î§
2
´æ´¢Ïà¶Ô±È½ÏСµÄÕûÊý¡£
±ÈÈç: Äê¼Í£¬ÊýÁ¿
INT
ÕûÊý£¬´Ó-2000000000 µ½ +2000000000 ·¶Î§
4
´æ´¢ÖеÈÕûÊý
ÀýÈç: ¾àÀë
BIGINT
²»ÄÜÓÃSMALLINT »ò INTÃèÊöµÄ³¬´óÕûÊý¡£
8
´æ´¢³¬´óµÄÕûÊý
ÀýÈç: ¿Æѧ/ÊýѧÊý¾Ý
FLOAT
µ¥¾«¶È¸¡µãÐÍÊý¾Ý
4
´æ´¢Ð¡ÊýÊý¾Ý
ÀýÈç:²âÁ¿£¬Î¶È
DOUBLE
Ë«¾«¶È¸¡µãÐÍÊý¾Ý
8
ÐèҪ˫¾«¶È´æ´¢µÄСÊýÊý¾Ý
ÀýÈç:¿ÆѧÊý¾Ý
DECIMAL
Óû§×Ô¶¨Ò徫¶ÈµÄ¸¡µãÐÍÊý¾Ý
±äÁ¿;È¡¾öÓÚ¾«¶ÈÓ볤¶È
ÒÔÌرð¸ßµÄ¾«¶È´æ´¢Ð¡ÊýÊý¾Ý¡£
ÀýÈç:»õ±ÒÊý¶î£¬¿ÆѧÊý¾Ý
CHAR
¹Ì¶¨³¤¶ÈµÄ×Ö·û´®
Ìض¨×Ö·û´®³¤¶È(¸ß´ï255×Ö·û)
´æ´¢Í¨³£°üº¬Ô¤¶¨Òå×Ö·û´®µÄ±äÁ¿
ÀýÈç: ¶¨ÆÚº½Ïߣ¬¹ú¼Ò»òÓʱà
VARCHAR
¾ßÓÐ×î´óÏÞÖƵĿɱ䳤¶ÈµÄ×Ö·û´®
±äÁ¿; 1 + ʵ¼Ê×Ö·û´®³¤¶È (¸ß´ï 255 ×Ö·û)
´æ´¢²»Í¬³¤¶ÈµÄ×Ö·û´®Öµ(¸ß´ïÒ»¸öÌض¨µÄ×î´óÏÞ¶È).
ÀýÈç:Ãû×Ö£¬ÃÜÂ룬¶ÌÎıêÇ©
TEXT
ûÓÐ×î´ó³¤¶ÈÏÞÖƵĿɱ䳤¶ÈµÄ×Ö·û´®
Variable; 2 +聽 actual string length
´æ´¢´óÐÍÎı¾Êý¾Ý
ÀýÈç: ÐÂÎŹÊÊ£¬²úÆ·ÃèÊö
BLOB
¶þ½øÖÆ×Ö·û´®
±äÁ¿£»2 + ʵ¼Ê×Ö·û´®³¤¶È
´æ´¢¶þ½øÖÆÊý¾Ý
ÀýÈç:ͼƬ£¬¸½¼þ£¬¶þ½øÖÆÎĵµ
DATE
ÒÔ yyyy-mm-dd¸ñʽµÄÈÕÆÚ
3
´æ´¢ÈÕÆÚ
ÀýÈç:ÉúÈÕ£¬²úÆ·ÂúÆÚ
TIME
ÒÔ hh:mm:ss¸ñʽµÄʱ¼ä
3
´æ´¢Ê±¼ä»òʱ¼ä¼ä¸ô
ÀýÈç:±¨¾¯Éù£¬Á½Ê±¼äÖ®¼äµÄ¼ä¸ô£¬ÈÎÎñ¿ªÊ¼/½áÊøʱ¼ä
DATETIME
ÒÔyyyy-mm-ddhh:mm:ss¸ñʽ½áºÏÈÕÆÚºÍʱ¼ä
8
´æ´¢°üº¬ÈÕÆÚºÍʱ¼äµÄÊý¾Ý
ÀýÈç:ÌáÐѵÄÈË£¬Ê¼þ
TIMESTAMP
ÒÔyyyy-mm-ddhh:mm:ss¸ñʽ½áºÏÈÕÆÚºÍʱ¼ä
4
¼Ç¼¼´Ê±Ê±¼ä
ÀýÈ磺ʼþÌáÐÑÆ÷£¬“×îºó½øÈ딵Äʱ¼ä±ê¼Ç
YEAR
ÒÔ yyyy¸ñʽµÄÄê·Ý
1
´æ´¢Äê·Ý
ÀýÈç:±ÏÒµÄ꣬³öÉúÄê
ENUM
Ò»×éÊý¾Ý£¬Óû§¿É´ÓÖÐÑ¡ÔñÆäÖÐÒ»¸ö
1»ò 2¸ö×Ö½Ú
´æ´¢×Ö·ûÊôÐÔ£¬Ö»ÄÜ´ÓÖÐÑ¡ÔñÖ®Ò»
ÀýÈç:²¼¶ûÁ¿Ñ¡Ôñ£¬ÈçÐÔ±ð
SET
Ò»×éÊý¾Ý£¬Óû§¿É´ÓÖÐÑ¡ÔñÆäÖÐ0£¬1»ò¸ü¶à¡£
´Ó1µ½8×Ö½Ú;È¡¾öÓÚÉèÖõĴóС
´æ´¢×Ö·ûÊôÐÔ£¬¿É´ÓÖÐÑ¡Ôñ¶à¸ö×Ö·ûµÄÁªºÏ¡£
ÀýÈç:¶àÑ¡ÏîÑ¡Ôñ£¬±ÈÈçÒµÓà°®ºÃºÍÐËȤ¡£
Ïà¹ØÎĵµ£º
²é¿´Ä³¸ö±íµÄ½¨±íÓï¾ä £ºshow create table data_statdata;
drop index ts on data_statdata;
Ë÷ÒýÊǼÓËÙ²éѯµÄÖ÷ÒªÊֶΣ¬Ìرð¶ÔÓÚÉæ¼°¶à¸ö±íµÄ²éѯ¸üÊÇÈç´Ë¡£±¾½ÚÖУ¬½«½éÉÜË÷ÒýµÄ×÷Óá¢Ìص㣬ÒÔ¼°´´½¨ºÍɾ³ýË÷ÒýµÄÓï·¨¡£
13.4.1 ʹÓÃË÷ÒýÓÅ»¯²éѯ
Ë÷ÒýÊÇ¿ìËÙ¶¨Î»Êý¾ÝµÄ¼¼Êõ£¬Ê×ÏÈͨ¹ýÒ»¸öʾÀýÀ´Á˽âÆ京Òå¼°×÷Óã ......
Ö÷£º
show master status;
+-----------------+------------+-------------------+-----------------------+
| File |
Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------ ......
Ê×ÏÈÒªÉùÃ÷һϣºÒ»°ãÇé¿öÏ£¬ÐÞ¸ÄMySQLÃÜÂ룬ÊÚȨ£¬ÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ġ£
×¢£º±¾²Ù×÷ÊÇÔÚWINÃüÁîÌáʾ·ûÏ£¬phpMyAdminͬÑùÊÊÓá£
Óû§£ºphplamp Óû§Êý¾Ý¿â£ºphplampDB
1.н¨Óû§¡£
//怬MYSQL
@>mysql -u root -p
@>ÃÜÂë
//´´½¨Óû§
mysql> insert into mysql.user ......
DATE_FORMAT(date,format)
¸ù¾Ýformat×Ö·û´®¸ñʽ»¯dateÖµ¡£ÏÂÁÐÐÞÊηû¿ÉÒÔ±»ÓÃÔÚformat×Ö·û´®ÖУº %M ÔÂÃû×Ö(January……December)
%W
ÐÇÆÚÃû×Ö(Sunday……Saturday)
%D ÓÐÓ¢Óïǰ׺µÄÔ·ݵÄÈÕÆÚ(1st, 2nd, 3rd, µÈµÈ¡££©
%Y Äê, Êý×Ö, 4 λ
%y Äê, Êý×Ö, 2 λ
%a ËõдµÄÐÇÆÚÃû×Ö(Sun ......