MySQL Êý¾Ý¿âµÄ±¸·ÝºÍ»Ö¸´
mysql,mysqldump,µ¼³ö,µ¼³ö±í,ѹËõµ¼³ömysql,mysqlhotcopy,mysql»¹Ô±í
±¾ÎÄÌÖÂÛ MySQL µÄ±¸·ÝºÍ»Ö¸´»úÖÆ£¬ÒÔ¼°ÈçºÎά»¤Êý¾Ý±í£¬°üÀ¨×îÖ÷ÒªµÄÁ½ÖÖ±íÀàÐÍ£ºMyISAM
ºÍ Innodb
£¬ÎÄÖÐÉè¼ÆµÄ MySQL °æ±¾Îª 5.0.22¡£
Ä¿Ç° MySQL Ö§³ÖµÄÃâ·Ñ±¸·Ý¹¤¾ßÓУºmysqldump¡¢mysqlhotcopy
£¬»¹¿ÉÒÔÓà SQL Óï·¨½øÐб¸·Ý£ºBACKUP TABLE
»òÕß SELECT INTO OUTFILE
£¬ÓÖ»òÕß±¸·Ý¶þ½øÖÆÈÕÖ¾£¨binlog£©
£¬»¹¿ÉÒÔÊÇÖ±½Ó¿½±´Êý¾ÝÎļþºÍÏà¹ØµÄÅäÖÃÎļþ
¡£MyISAM ±íÊDZ£´æ³ÉÎļþµÄÐÎʽ£¬Òò´ËÏà¶Ô±È½ÏÈÝÒ×±¸·Ý£¬ÉÏÃæÌáµ½µÄ¼¸ÖÖ·½·¨¶¼¿ÉÒÔʹÓá£Innodb
ËùÓÐµÄ±í¶¼±£´æÔÚͬһ¸öÊý¾ÝÎļþ ibdata1
ÖУ¨Ò²¿ÉÄÜÊǶà¸öÎļþ£¬»òÕßÊǶÀÁ¢µÄ±í¿Õ¼äÎļþ£©£¬Ïà¶ÔÀ´Ëµ±È½Ï²»ºÃ±¸·Ý£¬Ãâ·ÑµÄ·½°¸¿ÉÒÔÊÇ¿½±´Êý¾ÝÎļþ
¡¢±¸·Ý binlog
£¬»òÕßÓà mysqldump
¡£
1¡¢mysqldump
1.1 ±¸·Ý
mysqldump
ÊDzÉÓÃSQL¼¶±ðµÄ±¸·Ý»úÖÆ£¬Ëü½«Êý¾Ý±íµ¼³É SQL ½Å±¾Îļþ£¬ÔÚ²»Í¬µÄ MySQL °æ±¾Ö®¼äÉý¼¶Ê±Ïà¶Ô±È½ÏºÏÊÊ£¬ÕâÒ²ÊÇ×î³£Óõı¸·Ý·½·¨¡£ÏÖÔÚÀ´½²Ò»Ï mysqldump
µÄһЩÖ÷Òª²ÎÊý£º
--compatible=name
Ëü¸æËß mysqldump£¬µ¼³öµÄÊý¾Ý½«ºÍÄÄÖÖÊý¾Ý¿â»òÄĸö¾É°æ±¾µÄ MySQL ·þÎñÆ÷Ïà¼æÈÝ¡£Öµ¿ÉÒÔΪ ansi¡¢mysql323¡¢mysql40¡¢postgresql¡¢oracle¡¢mssql¡¢db2¡¢maxdb¡¢no_key_options¡¢no_tables_options¡¢no_field_options
µÈ£¬ÒªÊ¹Óü¸¸öÖµ£¬ÓöººÅ½«ËüÃǸô¿ª¡£µ±È»ÁË£¬Ëü²¢²»±£Ö¤ÄÜÍêÈ«¼æÈÝ£¬¶øÊǾ¡Á¿¼æÈÝ¡£
--complete-insert£¬-c
µ¼³öµÄÊý¾Ý²ÉÓðüº¬×Ö¶ÎÃûµÄÍêÕû INSERT
·½Ê½£¬Ò²¾ÍÊÇ°ÑËùÓеÄÖµ¶¼Ð´ÔÚÒ»ÐС£Õâô×öÄÜÌá¸ß²åÈëЧÂÊ£¬µ«ÊÇ¿ÉÄÜ»áÊܵ½ max_allowed_packet
²ÎÊýµÄÓ°Ïì¶øµ¼Ö²åÈëʧ°Ü¡£Òò´Ë£¬ÐèÒª½÷É÷ʹÓøòÎÊý£¬ÖÁÉÙÎÒ²»ÍƼö¡£
--default-character-set=charset
Ö¸¶¨µ¼³öÊý¾Ýʱ²ÉÓúÎÖÖ×Ö·û¼¯£¬Èç¹ûÊý¾Ý±í²»ÊDzÉÓÃĬÈ쵀 latin1
×Ö·û¼¯µÄ»°£¬ÄÇôµ¼³öʱ±ØÐëÖ¸¶¨¸ÃÑ¡Ï·ñÔòÔٴε¼ÈëÊý¾Ýºó½«²úÉúÂÒÂëÎÊÌâ¡£
--disable-keys
¸æËß mysqldump
ÔÚ INSERT
Óï¾äµÄ¿ªÍ·ºÍ½áβÔö¼Ó /*!40000 ALTER TABLE table DISABLE KEYS */;
ºÍ /*!40000 ALTER TABLE table ENABLE KEYS */;
Óï¾ä£¬ÕâÄÜ´ó´óÌá¸ß²åÈëÓï¾äµÄËٶȣ¬ÒòΪËüÊÇÔÚ²åÈëÍêËùÓÐÊý¾Ýºó²ÅÖؽ¨Ë÷ÒýµÄ¡£¸ÃÑ¡ÏîÖ»ÊÊºÏ MyISAM
񡭜
--extended-insert = true|false
ĬÈÏÇé¿öÏ£¬mysqldump
¿ªÆô --complete-insert
ģʽ£¬Òò´Ë²»ÏëÓÃËüµÄµÄ»°£¬¾ÍʹÓñ¾Ñ¡ÏÉ趨ËüµÄֵΪ false
¼´¿É¡£
--
Ïà¹ØÎĵµ£º
Ò»¡¢ÔÚ±àÒëʱÓÅ»¯MySQL
Èç¹ûÄã´ÓÔ´´úÂë·Ö·¢°²×°MySQL£¬Òª×¢Ò⣬±àÒë¹ý³Ì¶ÔÒÔºóµÄÄ¿±ê³ÌÐòÐÔÄÜÓÐÖØÒªµÄÓ°Ï죬²»Í¬µÄ±àÒ뷽ʽ¿ÉÄܵõ½ÀàËƵÄÄ¿±êÎļþ£¬µ«ÐÔÄÜ¿ÉÄÜÏà²îºÜ´ó£¬Òò´Ë£¬ÔÚ±àÒë°²×°MySQLÊÊÓ¦×Ðϸ¸ù¾ÝÄãµÄÓ¦ÓÃÀàÐÍÑ¡Ôñ×î¿ÉÄܺõıàÒëÑ¡Ïî¡£ÕâÖÖ¶¨ÖƵÄMySQL¿ÉÒÔΪÄãµÄÓ¦ÓÃÌṩ×î¼ÑÐÔÄÜ¡£
¼¼ÇÉ£ºÑ¡ÓýϺõıà ......
¸ã¶¨MySQLÊý¾Ý¿âÖÐÎÄÄ£ºý¼ìË÷ÎÊÌâ
×÷Õß: bianceng, ¡¡³ö´¦:ITר¼ÒÍøÂÛ̳,¡¡ÔðÈαà¼: ³Â×Óç÷,¡¡
2009-10-28 07:00
¡¡¡¡ÔÚ MySQLÏ£¬ÔÚ½øÐÐÖÐÎÄÄ£ºý¼ìË÷ʱ£¬¾³£»á·µ»ØһЩÓëÖ®²»Ïà¹ØµÄ¼Ç¼£¬Èç²éÕÒ "%a%" ʱ£¬·µ»ØµÄ¿ÉÄÜÓÐÖÐÎÄ×Ö·û£¬È´Ã»ÓÐa×Ö·û´æÔÚ¡£
¡¡¡¡ÔÚ MySQLÏ£¬ÔÚ½øÐÐÖÐÎÄÄ£ºý¼ìË÷ʱ£¬¾³£»á·µ»ØһЩÓë ......
Ë÷ÒýµÄ´ú¼Û
¡¡¡¡Ò»°ãÀ´Ëµ£¬Èç¹ûMySQLÄܹ»ÕÒµ½·½·¨£¬ÀûÓÃË÷ÒýÀ´¸ü¿ìµØ´¦Àí²éѯ£¬Ëü¾Í»áÕâÑù×ö¡£Õâ
Òâζ×Å£¬¶ÔÓÚ´ó¶àÊýÇé¿ö£¬Èç¹ûÄãûÓжԱí½øÐÐË÷Òý£¬¾Í»áʹÐÔÄÜÊܵ½Ë𺦡£Õâ¾ÍÊÇÎÒËùÃè»æµÄË÷ÒýÓŵãµÄÃÀ¾°¡£µ«ÊÇËüÓÐȱµãÂð£¿Óеģ¬ËüÔÚʱ¼äºÍ¿Õ¼äÉ϶¼Óпª
Ïú¡£ÔÚʵ¼ùÖУ¬Ë÷ÒýµÄÓŵãµÄ¼ÛÖµÒ»°ã»á³¬¹ýÕâЩȱµã£¬µ«ÊÇÄ ......
user±í:
id | name
———
1 | libk
2 | zyfon
3 | daodao
user_action±í:
user_id | action
—————
1 | jump
1 | kick
1 | jump
2 | run
4 | swim
sql:
select id, name, action from user as u
left join user_action a on u.id = a.user_id
result:
id | ......
PS:ÎÒ½ñÌìÅäÖà ·þÎñÆ÷µÄʱºò³öÏÖµÄÎÊÌâ¾ÍÊÇÕâ¸ö£¬µ«ÊÇÕÕ×Å·½·¨¶¼×öÁË£¬Ñ¾µÄ¡£¡£»¹ÊÇûÓ㬼«¶ÈÓôÃÆËÀ¡£¡£°¥¡£¡£¡£ÎÒÒ²²»ÖªµÀʲôÔÒòÄØ¡£¡£¿ÉÄܵÄÔÒò¶¼ÕÒ¹ýÁË¡£¡£ÓôÃÆ°¡`~
apache2+mysql+php5+phpmyadminÅäÖÃÎÊÌ⣺ÎÞ·¨¼ÓÈëmysqlÀ©Õ¹£¬Çë¼ì²éphpÅäÖÃ...
°²×°Íêapache2+mysql+php5ºó£¬°²×°phpmyadmin²¢ÅäÖúÃÒÔºó£¬ÔÚä¯À ......