MySQLÊý¾Ý¿â±¸·ÝºÍ»¹ÔµÄ³£ÓÃÃüÁî
±¸·ÝMySQLÊý¾Ý¿âµÄÃüÁî
mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ£¬Äܹ»Èøñ¸·Ý¸²¸ÇÒÑÓÐÊý¾Ý¿â¶ø²»ÐèÒªÊÖ¶¯É¾³ýÔÓÐÊý¾Ý¿â¡£
mysqldump -–add-drop-table -uusername -ppassword databasename > backupfile.sql
Ö±½Ó½«MySQLÊý¾Ý¿âѹËõ±¸·Ý
mysqldump -hhostname -uusername -ppassword databasename | gzip > backupfile.sql.gz
±¸·ÝMySQLÊý¾Ý¿âij¸ö(Щ)±í
mysqldump -hhostname -uusername -ppassword databasename specific_table1 specific_table2 > backupfile.sql
ͬʱ±¸·Ý¶à¸öMySQLÊý¾Ý¿â
mysqldump -hhostname -uusername -ppassword –databases databasename1 databasename2 databasename3 > multibackupfile.sql
½ö½ö±¸·ÝÊý¾Ý¿â½á¹¹
mysqldump –no-data –databases databasename1 databasename2 databasename3 > structurebackupfile.sql
±¸·Ý·þÎñÆ÷ÉÏËùÓÐÊý¾Ý¿â
mysqldump –all-databases > allbackupfile.sql
»¹ÔMySQLÊý¾Ý¿âµÄÃüÁî
mysql -hhostname -uusername -ppassword databasename < backupfile.sql
»¹ÔѹËõµÄMySQLÊý¾Ý¿â
gunzip < backupfile.sql.gz | mysql -uusername -ppassword databasename
½«Êý¾Ý¿âתÒƵ½Ð·þÎñÆ÷
mysqldump -uusername -ppassword databasename | mysql –host=*.*.*.* -C databasename
Ïà¹ØÎĵµ£º
Èç¹ûÒ»¸öMyISAM±í°üº¬Èκοɱ䳤¶ÈÁУ¨VARCHAR, BLOB»òTEXTDynamic£©£¬»òÕßÈç¹ûÒ»¸ö±í±»ÓÃROW_FORMAT=DYNAMICÑ¡ÏîÀ´´´½¨£¬¶¯Ì¬´æ´¢¸ñʽ±»Ê¹Óá£
Õâ¸ö¸ñʽ¸üΪ¸´ÔÓÒ»µã£¬ÒòΪÿÐÐÓÐÒ»¸ö±íÃ÷ÐÐÓж೤µÄÍ·¡£µ±Ò»¸ö¼Ç¼ÒòΪ¸üеĽá¹û±»±äµÃ¸ü³¤£¬¸Ã¼Ç¼Ҳ¿ÉÒÔÔÚ³¬¹ýÒ»¸öλÖô¦½áÊø¡£
Äã¿ÉÒÔʹÓÃOPTIMIZE TAB ......
×¢£º±¾ÎÄÌÖÂ۵ķ¶Î§ÎªÎ´ÆôÓÃMAXDBģʽµÄ±í£¡
½ñÌ콨ÁËÒ»¸ö±í£¬ÀïÃæÓÐÒ»¸öÁÐÊÇtimestampÀàÐÍ£¬ÎÒ±¾ÒâÊÇÔÚÊý¾Ý¸üÐÂʱ£¬Õâ¸ö×ֶεÄʱ¼äÄÜ×Ô¶¯¸üС£ÆñÖª¶ÔÕâ¸öÀàÐ͵ÄÖµ»¹²»ÉõÁ˽⣬µ¼Ö³ö´í¡£·¢ÏÖÕâ¸ö×Ö¶ÎÖ»ÊÇÔÚÕâÐÐÊý¾Ý½¨Á¢µÄʱºòÓÐÖµ£¬ÔÚ¸üеÄÈ´Îޱ仯¡£
²éÕÒ×ÊÁÏ£¬·¢ÏÖÊÇÎÒ ......
mysqlÖ´ÐÐsqlÓï¾äʱÓÐʱ»á³öÏÖCR_COMMANDS_OUT_OF_SYNC´íÎó£¨2014£©
ÌáʾÓïΪ
commands out of sync; you can't run this command now
ÍøÉ϶Դ˴íÎóµÄÃèÊöºÜÉÙ£¬¶øÇÒûÓиø³ö½â¾ö·½·¨¡£
ÆäʵÕâÊÇÒòΪÉÏÒ»¸ösqlÖ´Ðзµ»ØÁ˶à¸ö½á¹û¼¯£¬µ«Ã»Óаѽá¹û¶¼È¡³öÀ´£¬¾ÍÖ´ÐÐÁËеÄsqlÓï¾ä£¬¾Í»á²úÉúÕâ¸ö´íÎó¡£
Ó¦ÔÚsqlÓï¾äÖ´Ðкó ......
Æô¶¯£ºnet start mySql;
¡¡¡¡½øÈ룺mysql -u root -p/mysql -h localhost -u root -p databaseName;
¡¡¡¡ÁгöÊý¾Ý¿â£ºshow databases;
¡¡¡¡Ñ¡ÔñÊý¾Ý¿â£ºuse databaseName;
¡¡¡¡Áгö±í¸ñ£ºshow tables£»
¡¡¡¡ÏÔʾ±í¸ñÁеÄÊôÐÔ£ºshow columns from tableName£»
¡¡¡¡½¨Á¢Êý¾Ý¿â£ºsource fileName.txt;
¡¡¡¡Æ¥Åä× ......