MySQLÖеÄmysqldumpÃüÁîʹÓÃÏê½â
MySQLÓкܶà¿ÉÒÔµ¼ÈëÊý¾ÝµÄ·½·¨£¬È»¶øÕâЩֻÊÇÊý¾Ý´«ÊäÖеÄÒ»°ë£¬ÁíÍâµÄÒ»°ãÊÇ´ÓMySQLÊý¾Ý¿âÖе¼³öÊý¾Ý¡£ÓÐÐí¶àµÄÔÒòÎÒÃÇÐèÒªµ¼³öÊý¾Ý¡£Ò»¸öÖØÒªµÄÔÒòÊÇÓÃÓÚ±¸·ÝÊý¾Ý¿â¡£Êý¾ÝµÄÔì¼Û³£³£ÊÇ°º¹óµÄ£¬ÐèÒª½÷É÷´¦ÀíËüÃÇ¡£¾³£µØ±¸·Ý¿ÉÒÔ°ïÖú·ÀÖ¹±¦¹óÊý¾ÝµØ¶ªÊ§£»ÁíÍâÒ»¸öÔÒòÊÇ£¬Ò²ÐíÄúÏ£Íûµ¼³öÊý¾ÝÀ´¹²Ïí¡£ ÔÚÕâ¸öÐÅÏ¢¼¼Êõ²»¶Ï³É³¤µÄÊÀ½çÖУ¬¹²ÏíÊý¾Ý±äµÃÔ½À´Ô½³£¼û¡£
±È·½ËµMacmillan USAά»¤»¤×ÅÒ»¸ö½«Òª³ö°æµÄÊé¼®µÄ´óÐÍÊý¾Ý¿â¡£Õâ¸öÊý¾Ý¿âÔÚÐí¶àÊéµêÖ®¼ä¹²Ïí£¬ÕâÑùËûÃǾÍÖªµÀÄÄЩÊ齫»áºÜ¿ì³ö°æ¡£Ò½ÔºÔ½À´Ô½×ßÏò²ÉÓÃÎÞÖ½²¡Àú¼Ç¼£¬ÕâÑùÕâЩ²¡Àú¿ÉÒÔËæʱ¸ú×ÅÄã¡£ÊÀ½ç±äµÃÔ½À´Ô½Ð¡£¬ÐÅÏ¢Ò²±»¹²ÏíµÃÔ½À´Ô½¶à¡£ÓкܶàÖе¼³öÊý¾ÝµÃ·½·¨£¬ËüÃǶ¼¸úµ¼ÈëÊý¾ÝºÜÏàËÆ¡£ÒòΪ£¬±Ï¾¹£¬ÕâЩ¶¼Ö»ÊÇÒ»ÖÖ͸Êӵ÷½Ê½¡£´ÓÊý¾Ý¿âµ¼³öµÄÊý¾Ý¾ÍÊÇ´ÓÁíÒ»¶Ëµ¼ÈëµÄÊý¾Ý¡£ÕâÀïÎÒÃDz¢²»ÌÖÂÛÆäËûµÄÊý¾Ý¿â¸÷ÖÖ¸÷ÑùµÄµ¼³öÊý¾ÝµÄ·½·¨£¬Äú½«Ñ§»áÈçºÎÓÃMySQLÀ´ÊµÏÖÊý¾Ýµ¼³ö¡£
¡¡¡¡
¡¡¡¡Ê¹ÓÃmysqldump:
¡¡¡¡
¡¡¡¡(mysqldumpÃüÁîλÓÚmysql/bin/Ŀ¼ÖÐ)
¡¡¡¡mysqldump¹¤¾ßºÜ¶à·½ÃæÀàËÆÏà·´×÷ÓõŤ¾ßmysqlimport¡£ËüÃÇÓÐһЩͬÑùµÄÑ¡Ïî¡£µ«mysqldumpÄܹ»×ö¸ü¶àµÄÊÂÇé¡£Ëü¿ÉÒÔ°ÑÕû¸öÊý¾Ý¿â×°Ôص½Ò»¸öµ¥¶ÀµÄÎı¾ÎļþÖС£Õâ¸öÎļþ°üº¬ÓÐËùÓÐÖؽ¨ÄúµÄÊý¾Ý¿âËùÐèÒªµÄSQLÃüÁî¡£Õâ¸öÃüÁîÈ¡µÃËùÓеÄģʽ£¨Schema£¬ºóÃæÓнâÊÍ£©²¢ÇÒ½«Æäת»»³ÉDDLÓï·¨£¨CREATEÓï¾ä£¬¼´Êý¾Ý¿â¶¨ÒåÓï¾ä£©£¬È¡µÃËùÓеÄÊý¾Ý£¬²¢ÇÒ´ÓÕâЩÊý¾ÝÖд´½¨INSERTÓï¾ä¡£Õâ¸ö¹¤¾ß½«ÄúµÄÊý¾Ý¿âÖÐËùÓеÄÉè¼Æµ¹×ª¡£ÒòΪËùÓеĶ«Î÷¶¼±»°üº¬µ½ÁËÒ»¸öÎı¾ÎļþÖС£Õâ¸öÎı¾Îļþ¿ÉÒÔÓÃÒ»¸ö¼òµ¥µÄÅú´¦ÀíºÍÒ»¸öºÏÊÊSQLÓï¾äµ¼»Øµ½MySQLÖС£Õâ¸ö¹¤¾ßÁîÈËÄÑÒÔÖÃÐŵؼòµ¥¶ø¿ìËÙ¡£¾ö²»»áÓаëµãÈÃÈËÍ·Ì۵صط½¡£
¡¡¡¡
¡¡¡¡Òò´Ë£¬Èç¹ûÄúÏñ×°ÔØÕû¸öÊý¾Ý¿âMeet_A_GeekµÄÄÚÈݵ½Ò»¸öÎļþÖУ¬¿ÉÒÔʹÓÃÏÂÃæµÄÃüÁ
¡¡¡¡bin/mysqldump –p Meet_A_Geek > MeetAGeek_Dump_File.txt
¡¡¡¡
¡¡¡¡Õâ¸öÓï¾äÒ²ÔÊÐíÄúÖ¸¶¨Ò»¸ö±í½øÐÐdump(±¸·Ý/µ¼³ö/×°ÔØ?)¡£Èç¹ûÄúÖ»ÊÇÏ£Íû°ÑÊý¾Ý¿âMeet_A_GeekÖеıíOrdersÖеÄÕû¸öÄÚÈݵ¼³öµ½Ò»¸öÎļþ£¬¿ÉÒÔʹÓÃÏÂÃæµÄÃüÁ
¡¡¡¡bin/mysqldump –p Meet_A_Geek Orders >MeetAGeek_Orders.txt
¡¡¡¡
¡¡¡¡Õâ¸ö·Ç³£µÄÁé»î£¬ÄúÉõÖÁ¿ÉÒÔʹÓÃWHERE´Ó¾äÀ´Ñ¡ÔñÄúÐèÒªµÄ¼Ç¼µ¼³öµ½ÎļþÖС£Òª´ïµ½ÕâÑùµÄÄ¿µÄ£¬¿ÉÒÔʹÓÃÀàËÆÓÚÏÂÃæµÄÃüÁ
¡¡¡¡bin/mysqldump –p –where="Order_ID > 2
Ïà¹ØÎĵµ£º
ÔÚrootÕ˺ÅÖÐ,¿ÉÒÔÕý³£µ÷Óô洢¹ý³Ì.
»»µ½common_userÕ˺Åʱ,ͬһ´æ´¢¹ý³ÌÃûµ÷ÓóöÏÖÎÊÌâ.
×·×Ùµ÷ÊÔʱ³öÏÖ:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
ËÑË÷½â¾ö·½°¸:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;dat ......
ÔÚSentOS 5ÖУº
>>yum install mysql
°²×°Íê±Ïºó£¬
>>mysql
error:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(2)";
½ñÌì·þÎñÆ÷Óöµ½ÁËÒ»¸öºÜÊìϤµÄÎÊÌâ
ÊäÈë
#mysql -u root -p
ERROR 2002 (HY000):Can't connect to local MySQL server
  ......
MySQLΪÎÒÃÇÌṩÁ˺ܶà±íÀàÐ͹©Ñ¡Ôñ£¬ÓÐMyISAM¡¢ISAM¡¢HEAP¡¢BerkeleyDB¡¢InnoDB£¬MERGE±íÀàÐÍÿһÖÖ±íÀàÐͶ¼ÓÐÆä×Ô¼ºµÄÊôÐÔºÍÓŵ㡣ÏÂÃæÎÒÃÇÀ´¼òµ¥µÄÌÖÂÛһϡ£
MyISAM±íÀàÐÍ£º
MyISAM
±í(TYPE=MYISAM)ÊÇISAMÀàÐ͵ÄÒ»ÖÖÑÓÉ죬¾ßÓкܶàÓÅ»¯ºÍÔöÇ¿µÄÌØÐÔ¡£ÊÇMySQLµÄĬÈϱíÀàÐÍ¡£MyISAMÓÅ»¯ÁËѹËõ±ÈÀýºÍËٶȣ¬²¢ÇÒ
¿ÉÒ& ......
´´½¨µÄһЩ±í»á³öÏÖÕâÑùµÄÎÊÌ⣺ӢÎIJåÈëµ½±íÖÐûÓÐÈκÎÎÊÌâ¡£µ«ÊDzåÈëÖÐÎĵÄʱºò¾Í³öÏÖ Data truncation: Data too long for column 'name' at row 1 ÀàËƵÄÎÊÌâ¡£
mysqlÄÜ°ÑÓ¢ÎÄ×ֶβåÈçÊý¾Ý¿âÁË¡¡µ±ÎÒÊäÈëÖÐÎÄʱËû¾Í³öÏÖ×Ö¶ÎData truncation: Data too long for column 'name' at row 1
ÎÒʹÓÃÅóÓѵÄÕâ¸ö·½·¨£º(1)ÐÞ¸ ......