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
Ïà¹ØÎĵµ£º
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£¬Á½¸ ......
ºÃ¾ÃûÓÐÕûÀí¶«Î÷£¬¸Ð¾õ×Ô¼ºÔ½À´Ô½ÀÁ£¬ÕýºÃ½üÆÚÓиöMYSQLµÄÏîÄ¿£¨Ò»¸öORACLEµÄÓ¦ÓÃǨÒƵ½MYSQL£©£¬ÒÔǰûÓнӴ¥¹ýMYSQL£¬µ«ÊÇÒ²ÖªµÀMYSQLÊý¾Ý¿âÄ¿Ç°¹ã·ºµÄÓ¦ÓÃÔÚ¸÷ÖÖ¸öÈË¡¢ÉÌÎñϵͳÖУ¬¸÷ÖÖ¼¼Êõ¶¼±È½Ï³ÉÊì¡£°Ñ×Ô¼ºÑ§Ï°µÄһЩ¹ý³Ì×ܽáһϣ¬¸ÃÎÄÕÂÉè¼Æµ½µÄÄÚÈݶ¼Ã»ÓÐ×öÌ«ÏêϸµÄ²ûÊö£¬Ö»ÊÇÒ»¸ö¼òµ¥µÄÈëÃÅÊֲᡣ
  ......
Oracleº¯ÊýºÍmysqlº¯Êý±È½Ï
1. OracleÖеÄto_number()ת»»³ÉÊý×Ö£»
Oracle> Select to_number(‘123’) from dual; ----- 123;
&nbs ......
MySQLµÄ±¸·Ý·½Ê½£¬Ä¿Ç°ÎÒÏëµ½µÄÓÐÎåÖÖ£¬ÓпÉÄÜ»¹ÓÐ
1£¬mysqldump·½Ê½£¬¼ÓÉϾßÌå²ÎÊýÃû£¨µ¥¿â£¬¶à¿â£¬´¥·¢Æ÷£¬´æ´¢¹ý³Ì£¬±í½á¹¹£¬×Ö·û¼¯£¬–single-transaction£¬µÈµÈ£©
2£¬mysqlhotcopy Ö»Äܱ¸·ÝmyisamÊý¾Ý±í±¸·Ý£¬ËÙ¶ÈÏ൱¿ì£¬ÒòΪÊÇÎļþ¿½±´£¬¿ÉÄÜ˲¼ä±»Ëø±í£¬ÈκεÄÊý¾Ý²Ù×÷£¬±ÈÈç²åÈëºÍ¸üж¼»á¹ÒÆð¡£
3£¬LVMµ ......
½â¾öMySQL²»ÔÊÐí´ÓÔ¶³Ì·ÃÎʵķ½·¨
2009-06-04 13:11
1¡£ ¸Ä±í·¨¡£¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
Sql´úÂë ¸´ÖÆ´úÂë
1. mysql -u root -pvmwaremysql>us ......