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 ¼´¿É¡£
* --hex-blob
ʹÓÃÊ®Áù½øÖƸñʽµ¼³ö¶þ½øÖÆ×Ö·û´®×ֶΡ£Èç¹ûÓжþ½øÖÆÊý¾Ý¾Í±ØÐëʹÓñ¾Ñ¡Ïî¡£Ó°Ïìµ½µÄ×
Ïà¹ØÎĵµ£º
´¥·¢³ÌÐòÊÇÓë±íÓйصÄÃüÃûÊý¾Ý¿â¶ÔÏ󣬵±±íÉϳöÏÖÌض¨Ê¼þʱ£¬½«¼¤»î¸Ã¶ÔÏó¡£ÔÚijЩ´¥·¢³ÌÐòµÄÓ÷¨ÖУ¬¿ÉÓÃÓÚ¼ì²é²åÈëµ½±íÖеÄÖµ£¬»ò¶Ô¸üÐÂÉæ¼°µÄÖµ½øÐмÆËã¡£
´¥·¢³ÌÐòÓë±íÏà¹Ø£¬µ±¶Ô±íÖ´ÐÐINSERT¡¢DELETE»òUPDATEÓï¾äʱ£¬½«¼¤»î´¥·¢³ÌÐò¡£¿ÉÒÔ½«´¥·¢³ÌÐòÉèÖÃΪÔÚÖ´ÐÐÓï¾ä֮ǰ»òÖ®ºó¼¤»î¡£ÀýÈ磬¿ÉÒÔÔÚ´Ó±íÖÐɾ³ýÿһÐÐÖ® ......
ÏÈ¿´ÏÂÃæ×¢ÒâÄÚÈÝ
ÕûÕûŪÁËÒ»Ì죬ÖÕÓÚ½â¾öÁËjdbc(mysql-connector-java-5.0.30)ºÍmysqͨÐÅÖÐÎÄÂÒÂëµÄÎÊÌ⣡ÎÒµÄϵͳÊÇ
linux£¨ubuntu£©¡£ÔÚjavaÖУ¨Myeclipse»·¾³£©Ê¹ÓÃhibernateÁ¬½Ómysql¡£´æ´¢Ó¢ÎÄûÎÊÌ⣬д£¨insert
into£©ºÍ¶Á£¨select£©¶¼ÄÜÕýÈ·ÏÔʾ£¬µ«ÊÇÈôÆäÖдøÓÐÖÐÎÄ×Ö·û¾Í³ÉÂÒÂëÁË¡£µ½ÍøÉϲéÕÒÁË°ëÌì×ÊÁ ......
Îȹʶø֪У¬×î½üÓÖÓõ½ÁË£¬²Ý²ÝÄÃÀ´ÎÂϰһϣº×ª×Ô http://www.bccn.net/Article/sjk/mysql/jc/200601/3411.html
MySQL¹ÜÀíÔ±Ó¦¸ÃÖªµÀÈçºÎÉèÖÃMySQLÓû§Õ˺ţ¬Ö¸³öÄĸöÓû§¿ÉÒÔÁ¬½Ó·þÎñÆ÷£¬´ÓÄÄÀïÁ¬½Ó£¬Á¬½ÓºóÄÜ×öʲô¡£MySQL
3.22.11¿ªÊ¼ÒýÈëÁ½ÌõÓï¾äʹµÃÕâÏ×÷¸üÈÝÒ××ö£ºGRANTÓï¾ä´´½¨MySQLÓû§²¢Ö¸¶¨ÆäȨÏÞ£¬¶øREV ......
×¢£º±¾ÎÄÌÖÂ۵ķ¶Î§ÎªÎ´ÆôÓÃMAXDBģʽµÄ±í£¡
½ñÌ콨ÁËÒ»¸ö±í£¬ÀïÃæÓÐÒ»¸öÁÐÊÇtimestampÀàÐÍ£¬ÎÒ±¾ÒâÊÇÔÚÊý¾Ý¸üÐÂʱ£¬Õâ¸ö×ֶεÄʱ¼äÄÜ×Ô¶¯¸üС£ÆñÖª¶ÔÕâ¸öÀàÐ͵ÄÖµ»¹²»ÉõÁ˽⣬µ¼Ö³ö´í¡£·¢ÏÖÕâ¸ö×Ö¶ÎÖ»ÊÇÔÚÕâÐÐÊý¾Ý½¨Á¢µÄʱºòÓÐÖµ£¬ÔÚ¸üеÄÈ´Îޱ仯¡£
²éÕÒ×ÊÁÏ£¬·¢ÏÖÊÇÎÒ ......
Ò»´ÎNginx+PHP+MysqlµÄ²¢·¢²âÊÔ¾Àú
Ò»¡¢Ó²¼þ»·¾³
CPU:4ºËIntel(R) Xeon(R) CPU E5504 @ 2.00GHz
6GÄڴ棬120GÓ²ÅÌ
¶þ¡¢Èí¼þ»·¾³
L ......