Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQLË÷Òý·ÖÎöºÍÓÅ»¯Ë÷Òý·ÖÎö

Ë÷Òý
¡¡¡¡Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌض¨ÖµµÄ¼Ç¼£¬ËùÓÐMySQLË÷Òý¶¼ÒÔB-Ê÷µÄÐÎʽ±£´æ¡£Èç¹ûûÓÐË÷Òý£¬Ö´ÐвéѯʱMySQL±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨ÃèÕû¸ö±íµÄËùÓмǼ£¬Ö±ÖÁÕÒµ½·ûºÏÒªÇóµÄ¼Ç¼¡£±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£Èç¹û×÷ΪËÑË÷Ìõ¼þµÄÁÐÉÏÒѾ­´´½¨ÁËË÷Òý£¬MySQLÎÞÐèɨÃèÈκμǼ¼´¿ÉѸËٵõ½Ä¿±ê¼Ç¼ËùÔÚµÄλÖá£Èç¹û±íÓÐ1000¸ö¼Ç¼£¬Í¨¹ýË÷Òý²éÕҼǼÖÁÉÙÒª±È˳ÐòɨÃè¼Ç¼¿ì100±¶¡£
¡¡¡¡¼ÙÉèÎÒÃÇ´´½¨ÁËÒ»¸öÃûΪpeopleµÄ±í£º
¡¡¡¡CREATE TABLE people ( peopleid SMALLINT NOT NULL, name CHAR(50) NOT NULL );
¡¡¡¡È»ºó£¬ÎÒÃÇÍêÈ«Ëæ»ú°Ñ1000¸ö²»Í¬nameÖµ²åÈëµ½people±í¡£ÏÂͼÏÔʾÁËpeople±íËùÔÚÊý¾ÝÎļþµÄһС²¿·Ö£º
¡¡¡¡¿ÉÒÔ¿´µ½£¬ÔÚÊý¾ÝÎļþÖÐnameÁÐûÓÐÈκÎÃ÷È·µÄ´ÎÐò¡£Èç¹ûÎÒÃÇ´´½¨ÁËnameÁеÄË÷Òý£¬MySQL½«ÔÚË÷ÒýÖÐÅÅÐònameÁУº
¡¡¡¡¶ÔÓÚË÷ÒýÖеÄÿһÏMySQLÔÚÄÚ²¿ÎªËü±£´æÒ»¸öÊý¾ÝÎļþÖÐʵ¼Ê¼Ç¼ËùÔÚλÖõēָÕ딡£Òò´Ë£¬Èç¹ûÎÒÃÇÒª²éÕÒnameµÈÓÚ“Mike”¼Ç¼µÄpeopleid£¨SQLÃüÁîΪ“SELECT peopleid from people WHERE name='Mike';”£©£¬MySQLÄܹ»ÔÚnameµÄË÷ÒýÖвéÕÒ“Mike”Öµ£¬È»ºóÖ±½Óתµ½Êý¾ÝÎļþÖÐÏàÓ¦µÄÐУ¬×¼È·µØ·µ»Ø¸ÃÐеÄpeopleid£¨999£©¡£ÔÚÕâ¸ö¹ý³ÌÖУ¬MySQLÖ»Ðè´¦ÀíÒ»¸öÐоͿÉÒÔ·µ»Ø½á¹û¡£Èç¹ûûÓГname”ÁеÄË÷Òý£¬MySQLҪɨÃèÊý¾ÝÎļþÖеÄËùÓмǼ£¬¼´1000¸ö¼Ç¼£¡ÏÔÈ»£¬ÐèÒªMySQL´¦ÀíµÄ¼Ç¼ÊýÁ¿Ô½ÉÙ£¬ÔòËüÍê³ÉÈÎÎñµÄËٶȾÍÔ½¿ì¡£
¡¡¡¡Ë÷ÒýµÄÀàÐÍ
¡¡¡¡MySQLÌṩ¶àÖÖË÷ÒýÀàÐ͹©Ñ¡Ôñ£º
¡¡¡¡ÆÕͨË÷Òý
¡¡¡¡ÕâÊÇ×î»ù±¾µÄË÷ÒýÀàÐÍ£¬¶øÇÒËüûÓÐΨһÐÔÖ®ÀàµÄÏÞÖÆ¡£ÆÕͨË÷Òý¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖ·½Ê½´´½¨£º
¡¡¡¡´´½¨Ë÷Òý£¬ÀýÈçCREATE INDEX <Ë÷ÒýµÄÃû×Ö> ON tablename (ÁеÄÁбí); ÐÞ¸Ä±í£¬ÀýÈçALTER TABLE tablename ADD INDEX [Ë÷ÒýµÄÃû×Ö] (ÁеÄÁбí); ´´½¨±íµÄʱºòÖ¸¶¨Ë÷Òý£¬ÀýÈçCREATE TABLE tablename ( [...], INDEX [Ë÷ÒýµÄÃû×Ö] (ÁеÄÁбí) );
¡¡¡¡Î¨Ò»ÐÔË÷Òý
¡¡¡¡ÕâÖÖË÷ÒýºÍÇ°ÃæµÄ“ÆÕͨË÷Òý”»ù±¾Ïàͬ£¬µ«ÓÐÒ»¸öÇø±ð£ºË÷ÒýÁеÄËùÓÐÖµ¶¼Ö»ÄܳöÏÖÒ»´Î£¬¼´±ØÐëΨһ¡£Î¨Ò»ÐÔË÷Òý¿ÉÒÔÓÃÒÔϼ¸ÖÖ·½Ê½´´½¨£º
¡¡¡¡´´½¨Ë÷Òý£¬ÀýÈçCREATE UNIQUE INDEX <Ë÷ÒýµÄÃû×Ö> ON tablename (ÁеÄÁбí); ÐÞ¸Ä±í£¬ÀýÈçALTER TABLE tablename ADD UNIQUE [Ë÷ÒýµÄÃû×Ö] (ÁеÄÁбí); ´´½¨±íµÄʱºòÖ¸¶¨Ë÷Òý£¬ÀýÈçCREATE TABLE tablename


Ïà¹ØÎĵµ£º

mySql Îı¾×ֶ㤶È

BLOB
TEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ65535(2^16-1)¸ö×Ö·û¡£
MEDIUMBLOB
MEDIUMTEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ16777215(2^24-1)¸ö×Ö·û¡£
LONGBLOB
LONGTEXT
Ò»¸öBLOB»òTEXTÁУ¬×î´ó³¤¶ÈΪ4294967295(2^32-1)¸ö×Ö·û¡£
¿Éͨ¹ýÐÞ¸Äphp.iniÎļþ£¬¸Ä±ä×î´ó³¤¶ÈÉèÖá£
; Valid range 0 - 2147483647.  ......

Mysql ѧϰ±Ê¼Ç

 ÏÔʾËùÓÐÊý¾Ý¿â show databases;
 ´´½¨Êý¾Ý¿â create dababase stu;
 É¾³ýÊý¾Ý¿âdrop database stu;
 Çл»µ½Êý¾Ý¿âuse stu;
 È¡µÃµ±Ç°µÄÊý¾Ý¿â,´ø£¨£©±íʾº¯Êý:select database();
´´½¨±í£¨ÒªÇл»µ½Êý¾Ý¿âÖУ©
mysql> create table stu_info(
   
-> stu_id int(8) ......

mysql Ð޸ıí½á¹¹

1. mysql Ð޸ıíÃû×Ö
    ALTER TABLE t1 RENAME t2;
2. ÐÞ¸ÄÁеÄÃû×Ö
    >ALTER TABLE stock CHANGE COLUMN stock_id id INT(6);
3. Ôö¼ÓÁÐ
    >ALTER TABLE ab ADD COLUMN id INT(3);
4. ¼õÉÙÁÐ
   >ALTER TABLE ab DROP COLUMN id;
5. ÐÞ¸ÄÁ ......

nginx+php cgi+mysqlÒ»¼ü°²×°°ü¸üаæ

[part1] http://download.csdn.net/source/2076258 
[part2] http://download.csdn.net/source/2076272
[part3] http://download.csdn.net/source/2076276
[part4] http://download.csdn.net/source/2076283
[part02-04] http://www.ytgps.com/Images/nginx.rar
±¾ÎļþÌå»ý¹ý´ó·Ö4¸ö°ü£¬php-cgi+mysql+nginx.7z ......

MysqlÎļ¯

µ¼ÈëÊý¾ÝÖ¸¶¨ÁÐ
load data local infile 'D:\\service_func_utf8.txt' into table service_func fields terminated by '\t' (service_id, func_id1, func_id2, func_id3, func_id4, func_id5, func_id6);
MYSQL½«²éѯ½á¹ûµ¼³öµ½Îļþ
select * from tablename into outfile '/tmp/test.txt';
MYSQLÁªºÏÖ÷¼ü
create  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ