Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : mysql

MySQL µ¼Èëµ¼³öÃüÁî

      ×î½ü±ðÈËÔÚ¸øÎÒ sql Îļþʱ¼òµ¥µÄÌáÁËÏ µ¼Èë/µ¼³ö ÃüÁÔÚ´Ë»ù´¡ÉÏѧϰÁËÏ£¬×ܽᵽ myhere¡£
    ¹æ¶¨£º
Óû§Ãû£ºdb_user
Õʺţº db_pass
Êý¾Ý¿â£º db_name
񡜧 table_name_1, table_name_2
    ˵Ã÷£º  һЩ²Ù×÷ÐèÒªÓÐÊʵ±µÄȨÏÞ¡£
1. µ¼³ö
mysqldump -udb_name -pdb_pass db_name > db_name.bak.sql
// µ¼³öÕû¸öÊý¾Ý¿â db_name
// ÎļþĬÈϱ£´æÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
mysqldump -udb_name -pdb_pass db_name table_name_1 > db_bame-table_name_1.bak.sql
// µ¼³öÊý¾Ý¿â db_name Öбí table_name_1
// ÎļþĬÈϱ£´æÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
// ˵Ã÷£ºµ¼³öµÄÎļþÊǺ¬Óн¨±íÓï¾äµÄ¡£
2. µ¼Èë
mysql -udb_name -pdb_pass db_name < table_name_1.bak.sql
// µ¼Èë±íµ½Êý¾Ý¿â db_name
// ÔÚûÓÐÁ¬½ÓÊý¾ÝµÄʱºòµ¼Èë
// ÎļþĬÈÏÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
source table_name_1.bak.sql
// ÒѾ­Á¬½ÓºÃÊý¾Ý¿â·þÎñÆ÷£¬²¢ÇÒÑ¡ÔñÁËÊý¾Ý¿â use db_name
// ÎļþĬÈÏÔÚÖ´ÐÐ mysql ÃüÁîµÄĿ¼
// ˵Ã÷£º µ¼ÈëµÄÎļþÐèÊǺ¬Óмû±íÓï¾äµÄ¡£
3. select...into outfile s ......

MySQLѧϰ

C APIÏà¹Ø
C APIÊý¾ÝÀàÐÍ
 MYSQL
¸Ã½á¹¹´ú±í1¸öÊý¾Ý¿âÁ¬½ÓµÄ¾ä±ú¡£¼¸ºõËùÓеÄMySQLº¯Êý¾ùʹÓÃËü¡£²»Ó¦³¢ÊÔ¿½±´MYSQL½á¹¹¡£²»±£Ö¤ÕâÀ࿽±´½á¹û»áÓÐÓá£
 MYSQL_RES
¸Ã½á¹¹´ú±í·µ»ØÐеIJéѯ½á¹û£¨SELECT, SHOW, DESCRIBE, EXPLAIN£©¡£ÔÚ±¾½ÚµÄÊ£Óಿ·Ö£¬½«²éѯ·µ»ØµÄÐÅÏ¢³ÆΪ“½á¹û¼¯”¡£
 MYSQL_ROW
ÕâÊÇ1ÐÐÊý¾ÝµÄ“ÀàÐÍ°²È«”±íʾ¡£ËüÄ¿Ç°ÊÇ°´ÕÕ¼ÆÊý×Ö½Ú×Ö·û´®µÄÊý×éʵʩµÄ¡££¨Èç¹û×Ö¶ÎÖµ¿ÉÄÜ°üº¬¶þ½øÖÆÊý¾Ý£¬²»Äܽ«Æäµ±×÷ÓÉNullÖÕ½áµÄ×Ö·û´®¶Ô´ý£¬ÕâÊÇÒòΪÕâÀàÖµ¿ÉÄÜ»á°üº¬Null×Ö½Ú£©¡£ÐÐÊÇͨ¹ýµ÷ÓÃmysql_fetch_row()»ñµÃµÄ¡£
 MYSQL_FIELD
¸Ã½á¹¹°üº¬¹ØÓÚ×ֶεÄÐÅÏ¢£¬Èç×Ö¶ÎÃû¡¢ÀàÐͺʹóС¡£ÕâÀïÏêϸ½éÉÜÁËÆä³ÉÔ±¡£Í¨¹ýÖظ´µ÷ÓÃmysql_fetch_field()£¬¿ÉΪÿ¸ö×ֶλñµÃMYSQL_FIELD½á¹¹¡£×Ö¶ÎÖµ²»ÊǸýṹµÄ×é³É²¿·Ý£¬ËüÃÇ°üº¬ÔÚMYSQL_ROW½á¹¹ÖС£
 MYSQL_FIELD_OFFSET
ÕâÊÇMySQL×Ö¶ÎÁбíÆ«ÒÆÁ¿µÄ“ÀàÐÍ°²È«”±íʾ£¨ÓÉmysql_field_seek()ʹÓã©¡£Æ«ÒÆÁ¿ÊÇÐÐÄÚµÄ×ֶαàºÅ£¬´Ó0¿ªÊ¼¡£
 my_ulonglong
ÓÃÓÚÐÐÊýÒÔ¼°mysql_affected_rows()¡¢mysql_num_rows()ºÍmysql_insert_id()µÄÀàÐÍ¡£ ......

Tomcat+MySQl JDBCÁ¬½Ó³ØµÄÅäÖÃ

1¡¢°²×°Tomcat
JDBCÁ¬½Ó³ØÅäÖõĵÚÒ»²½ÊÇÏÂÔغͰ²×°Tomcat¡£²Î¿¼Tomcat for window µÄ°²×°Ïòµ¼£¬»ù±¾Ö±½Ó°²×°¼´¿É£¬×¢Ò⣺°²×°Ê±»áÌáʾÊäÈë¹ÜÀíÓû§ÃûºÍÃÜÂ룬ÕâÊÇÒÔºó»áÓõ½µÄÓû§ÃûºÍÃÜÂ룬Çмǡ£
2¡¢°²×°MySql
ĬÈÏ°²×°¼´¿É¡£
3¡¢Ê¹ÓÃTomcatµÄWeb¹ÜÀíÓ¦ÓÃÅäÖÃÊý¾ÝÔ´
Æô¶¯Tomcat·þÎñÆ÷£¬´ò¿ªä¯ÀÀÆ÷£¬ÊäÈëhttp://localhost:8080/admin/£¨ÆäÖÐlocalhost¿ÉÄÜÊÇһ̨»úÆ÷µÄIP»òÊÇ·þÎñÆ÷Ãû³Æ£©£¬½øÈë¹ÜÀí½çÃæµÄµÇ½ҳÃ棬ÕâʱºòÇëÊäÈëÔ­À´°²×°Ê±ÒªÇóÊäÈëµÄÓû§ÃûºÍÃÜÂ룬µÇ½µ½¹ÜÀí½çÃ棬
Ñ¡ÔñResources£­Data sources½øÈëJDBCÁ¬½Ó³ØÅäÖÃÊý¾ÝÔ´½çÃ棬ѡÔñData Source Actions £­>Ñ¡ÔñCreate New Data Source,½øÈëÅäÖÃÏêϸÐÅÏ¢½çÃ棬ÄÚÈÝÈçÏ£º
JNDI Name:    jdbc/mysql   Data Source URL:  jdbc:mysql://192.168.0.16/SUBRDB     JDBC Driver Class:   org.gjt.mm.mysql.Driver    User Name:    root   Password:     ********   Max. Active Connections:& ......

Çë×¢ÒâMYSQLÓï¾äÖеÄÒýºÅ

SQL #1: select * from uchome_feed where uid in('0',501...) order by dateline desc limit 0,50;
SQL #2: select * from uchome_feed where uid in(0,501...) order by dateline desc limit 0,50;
SQL #1  ÊÇCSDN ¸öÈË¿Õ¼ä»ñÈ¡¸öÈ˶¯Ì¬µÄSQL£¬ÊôUCHÔ­°æSQL¡£
SQL #2 ÊÇÈ¥µôµ¥ÒýºÅ(SQL #1ÖкìÉ«²¿·Ö)ºóµÄSQL£¬Á½¸öSQL²î±ðÖ»ÊÇÔÚÒýºÅ¡£
´ÓϱߵÄÁ½ÕŽØͼ¿´£¬Á½¸öSQLµÄÔËÐÐʱ¼äÈ·Ïà²îÉõÔ¶¡£SQL #2ЧÂʸ߳öºÜ¶à¡£
ЧÂʲ»Í¬µÄÔ­Òò£º Á½¸öSQLÓÃÁ˲»Í¬µÄË÷Òý£¡
SQL #1ʹÓÃdateline×÷ΪË÷Òý£¬¶ø SQL #2 ʹÓÃuid×÷ΪË÷Òý¡£
......

ͨ¹ý·ÖÇø£¨Partition£©ÌáÉýMySQLÐÔÄÜ

½ñÌìÕâô¼¤¶¯ÓÖÏëдÎÄÕµÄÔ­ÒòÊÇMySQL5.1µÄ·¢²¼´øÀ´ÁËÉè¼Æ³¬Ç¿¶¯Á¦Êý¾Ý¿âµÄÇ¿ÓÐÁ¦µÄÎäÆ÷£¬ÈκÎMySQLµÄDBA¶¼Ó¦¸Ã¾¡¿ìѧϰ²¢Ê¹ÓÃËü¡£ÎÒ¾õµÃÈç¹û­ÄܺܺõÎʹÓÃÕâ¸ö5.1°æ´øÀ´µÄÐÂÌØÐÔ£¬DBA¿ÉÒÔʹ×Ô¼º¹ÜÀíµÄVLDB£¨²»ÖªµÀʲôÊÇVLDB£¿¸æËßÄ㣬ÊǺôóºÃ´óµÄÊý¾Ý¿âµÄÒâ˼£¬Very Large DB£©»òÊý¾Ý²Ö¿âÆæ¼£°ãµÄ»ñµÃ¾Þ´óµÄÐÔÄÜÌáÉý¡£
¡¡¡¡Ê²Ã´ÊÇÊý¾Ý¿â·ÖÇø£¿
¡¡¡¡Êý¾Ý¿â·ÖÇøÊÇÒ»ÖÖÎïÀíÊý¾Ý¿âÉè¼Æ¼¼Êõ£¬DBAºÍÊý¾Ý¿â½¨Ä£ÈËÔ±¶ÔÆäÏ൱ÊìϤ¡£ËäÈ»·ÖÇø¼¼Êõ¿ÉÒÔʵÏֺܶàЧ¹û£¬µ«ÆäÖ÷ҪĿµÄÊÇΪÁËÔÚÌض¨µÄSQL²Ù×÷ÖмõÉÙÊý¾Ý¶Á­Ð´µÄ×ÜÁ¿ÒÔËõ¼õÏìӦʱ¼ä¡£
¡¡¡¡·ÖÇøÖ÷ÒªÓÐÁ½ÖÖÐÎʽ£º//ÕâÀïÒ»¶¨Òª×¢ÒâÐкÍÁеĸÅÄrowÊÇÐУ¬columnÊÇÁУ©
¡¡¡¡Ë®Æ½·ÖÇø£¨Horizontal Partitioning£©
¡¡¡¡ÕâÖÖÐÎʽ·ÖÇøÊǶԱíµÄÐнøÐзÖÇø£¬Í¨¹ýÕâÑùµÄ·½Ê½²»Í¬·Ö×éÀïÃæµÄÎïÀíÁзָîµÄÊý¾Ý¼¯µÃÒÔ×éºÏ£¬´Ó¶ø½øÐиöÌå·Ö¸î£¨µ¥·ÖÇø£©»ò¼¯Ìå·Ö¸î£¨1¸ö»ò¶à¸ö·ÖÇø£©¡£ËùÓÐÔÚ­±íÖж¨ÒåµÄÁÐÔÚÿ¸öÊý¾Ý¼¯Öж¼ÄÜÕÒµ½£¬ËùÒÔ±íµÄÌØÐÔÒÀÈ»µÃÒÔ±£³Ö¡£
¡¡¡¡¾Ù¸ö¼òµ¥Àý×Ó£ºÒ»¸ö°üº¬Ê®Ä귢Ʊ¼Ç¼µÄ±í¿ÉÒÔ±»·ÖÇøΪʮ¸ö²»Í¬µÄ·ÖÇø£¬Ã¿¸ö·ÖÇø°üº¬µÄÊÇÆäÖÐÒ»ÄêµÄ¼Ç¼¡££¨ÅóÞÈ×¢£ºÕâÀï¾ßÌåʹÓõķÖÇø·½Ê½ÎÒÃǺóÃæÔÙ˵£ ......

Mysql Innodb ÒýÇæÓÅ»¯(


²ÎÊýƪ
×÷/ÒëÕߣºÎâ±þÎý£¬À´Ô´£ºhttp://imysql.cn¡¡£¦¡¡http://imysql.cn/blog/3208¡¡×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
 
½éÉÜ£º
¡¡¡¡InnoDB¸øMySQLÌṩÁ˾ßÓÐÌá½»£¬»Ø¹öºÍ±ÀÀ£»Ö¸´ÄÜÁ¦µÄÊÂÎñ°²È«£¨ACID¼æÈÝ£©´æ´¢ÒýÇæ¡£InnoDBËø¶¨ÔÚÐм¶²¢ÇÒÒ²ÔÚSELECTÓï¾äÌṩһ¸öOracle·ç¸ñÒ»ÖµķÇËø¶¨¶Á¡£ÕâЩÌØÉ«Ôö¼ÓÁ˶àÓû§²¿ÊðºÍÐÔÄÜ¡£Ã»ÓÐÔÚInnoDBÖÐÀ©´óËø¶¨µÄÐèÒª£¬ÒòΪÔÚInnoDBÖÐÐм¶Ëø¶¨ÊʺϷdz£Ð¡µÄ¿Õ¼ä¡£InnoDBÒ²Ö§³ÖFOREIGN KEYÇ¿ÖÆ¡£ÔÚSQL²éѯÖУ¬Äã¿ÉÒÔ×ÔÓɵؽ«InnoDBÀàÐ͵ıíÓëÆäËüMySQLµÄ±íµÄÀàÐÍ»ìºÏÆðÀ´£¬ÉõÖÁÔÚͬһ¸ö²éѯÖÐÒ²¿ÉÒÔ»ìºÏ¡£
¡¡Innodb µÄ´´Ê¼ÈË£ºHeikki Tuuri
¡¡Heikki TuuriÔڣɣî£î£ï£ä£âµÄ£Â£õ£çÉçÇøÀïÒ²ÊǺܻîÔ¾µÄ£¬Èç¹ûÓöµ½£Â£õ£çÒ²¿ÉÒÔÖ±½ÓÌáµ½ÉçÇø£¬µÃµ½×÷ÕߵĽâ´ð¡£
ΪʲôҪѧϰ£É£î£î£ï£ä£âµÄµ÷ÓÅ£º
¡¡¡¡Ä¿Ç°À´Ëµ£ºInnoDBÊÇΪMysql´¦Àí¾Þ´óÊý¾ÝÁ¿Ê±µÄ×î´óÐÔÄÜÉè¼Æ¡£ËüµÄCPUЧÂÊ¿ÉÄÜÊÇÈκÎÆäËü»ùÓÚ´ÅÅ̵ĹØϵÊý¾Ý¿âÒýÇæËù²»ÄÜÆ¥µÐµÄ¡£ÔÚÊý¾ÝÁ¿´óµÄÍøÕ¾»òÊÇÓ¦ÓÃÖÐInnodbÊDZ¶ÊÜÇàíùµÄ¡£
¡¡¡¡ÁíÒ»·½Ã棬ÔÚÊý¾Ý¿âµÄ¸´ÖƲÙ×÷ÖÐInnodbÒ²ÊÇÄܱ£Ö¤masterºÍslaveÊý¾ÝÒ»ÖÂÓÐÒ»¶¨µÄ×÷Óá£
²ÎÊýµ÷ÓÅÄÚÈÝ£º
¡ ......
×ܼǼÊý:2220; ×ÜÒ³Êý:370; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [353] [354] [355] [356] 357 [358] [359] [360] [361] [362]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ