MYSQL±¸·Ý»Ö¸´
ÒòΪMySQL±í±£´æΪÎļþ·½Ê½£¬ºÜÈÝÒ×±¸·Ý¡£ÒªÏë±£³Ö±¸·ÝµÄÒ»ÖÂÐÔ£¬¶ÔÏà¹Ø±íÖ´ÐÐLOCK TABLES²Ù×÷£¬È»ºó¶Ô±íÖ´ÐÐFLUSH TABLES¡£ÄãÖ»ÐèÒª¶ÁËø¶¨£»ÕâÑùµ±Ä㸴ÖÆÊý¾Ý¿âĿ¼ÖеÄÎļþʱ£¬ÔÊÐíÆäËü¿Í»§¼ÌÐø²éѯ±í¡£ÐèÒªFLUSH TABLESÓï¾äÀ´È·±£¿ªÊ¼±¸·ÝÇ°½«ËùÓ줻îµÄË÷ÒýҳдÈëÓ²ÅÌ¡£
±¸·Ý·½·¨£º
A.±¸·ÝµÄÊÇSQL½Å±¾
1.µ¼³ö½á¹¹²»µ¼³öÊý¾Ý
cmd>mysqldump -B repltest -d --opt > xxx.sql
2.µ¼³öÊý¾Ý²»µ¼³ö½á¹¹
cmd>mysqldump -B repltest -t --opt > xxx.sql
3.µ¼³öÊý¾ÝºÍ±í½á¹¹
cmd>mysqldump repltest --opt > xxx.sql
cmd>mysqldump -B repltest --opt > xxx.sql
cmd>mysqldump --databases repltest --opt > xxx.sql
4.µ¼³öÌض¨±í
cmd>mysqldump -B repltest --table t1 t2 --opt > xxx.sql
5.µ¼³öÌø¹ýÌض¨±í
cmd>mysqldump -B repltest --ignore-table=repltest.t1 --ignore-table=repltest.t2 --opt > xxx.sql
B.±¸·ÝµÄÊÇ´¿Êý¾Ý
6.µ¼³öÊý¾Ý£¬´ÓÌض¨±í
mysql>select * into outfile 'xxx.txt' fields terminated by ',' from t1
7.µ¼³ö±í½á¹¹µÄSQL½Å±¾¼°Êý¾ÝÎļþ
cmd>mysqldump repltest --tab=q:\dbbackup
»Ö¸´·½·¨£º
A.Õë¶ÔSQL½Å±¾ÀàµÄ±¸·ÝÖ´Ðлָ´
1.»Ö¸´²¢¸²¸ÇÏÖÓÐÊý¾Ý¿â¡£Õë¶ÔÍêÕûµÄÊý¾Ý¿â±¸·Ý£¨SQL½Å±¾°üº¬CREATE DATABASE£©
CMD>mysql -u root -p <xxx.sql
2.»Ö¸´µ½ÐµÄÊý¾Ý¿â¡£Õë¶ÔÍêÕûµÄÊý¾Ý¿â±¸·Ý£¨SQL½Å±¾°üº¬CREATE DATABASE£©
Ê×ÏÈ£¬É¾³ýSQL½Å±¾ÀïCREATE DATABASEµÄ²¿·Ö
È»ºó£¬CMD>mysql -u root -p newDB<xxx.sql
3.»Ö¸´Ìض¨µÄSQL½Å±¾±¸·Ý
CMD>mysql -u root -p <xxx.sql
B.Õë¶Ô´¿Êý¾ÝÀàµÄ±¸·ÝÖ´Ðлָ´
4.µ¼ÈëÊý¾Ýµ½Ìض¨±í£¨Õë¶Ôselect into outfile£©
mysql>load data infile 'xxx.txt' into table db.t1. fields terminated by ',';
5.µ¼ÈëÊý¾Ýµ½Ìض¨±í£¨Ê¹ÓÃmysqlimport£©
cmd>mysqlimport DB -u root -p -l -d 't1.txt'
MySQLimportµÄ³£ÓÃÑ¡Ïî½éÉÜ:
¡¡¡¡
Ïà¹ØÎĵµ£º
×òÌ죬¹«Ë¾´Ó·þÎñÆ÷ÉϸãÏÂÀ´Ò»¸ö´óµÄÊý¾Ý¿â£¬Îļþ´óСΪ487MB£¬ÓÐͬÊÂ˵½«php.iniµÄÎļþÅäÖÃÖеÄpost_max_size¸ÄΪ±ÈÄãÒªµ¼ÈëµÄÊý¾Ý¿âÎļþ´óһЩµÄ£¬±ÈÈçÏÖÔÚÎÒÒªµÄµ¼ÈëµÄÊý¾Ý¿âÎļþÊÇ487MB£¬ÄÇô¿ÉÒÔ½«´ËÏî¸ü¸ÄΪ£º700MB£¬ÔÙʹÓÃphpMyAdmin¹¤¾ßµÄµ¼È빦ÄÜÀ´ÊµÏÖ£¬µ«ÊÇ£¬ÎÒÊÔÓÃÁË´ËÖÖ·½·¨²»ÄÜ×àЧ£¬È»ºóÓëÓоÑéµÄÅóÓѽ»Á÷£ ......
MySQLÖØа²×°µÄʱºò³öÏÖÁËÎÊÌ⣺Could not start the service MySQL. Error:0,ÔÒòÊÇûÓжԾɵÄMySQLÍêȫжÔصô¡£
ÔÚÄã´ÓµçÄÔÀïжÔؾɵÄMYSQLÊý¾Ý¿â·þÎñʱ£¬Ê×ÏÈÏÈÔÚWINDOWS·þÎñÀïÍ£µôMYSQLµÄ·þÎñ¡£ÔÙµ½¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý£¬È»ºóÊÖ¶¯É¾³ýÔ°²×°Îļþ,µ«ÊÇÄã²¢²»ÄÜÍêÕûµÄ°ÑMYSQL·þÎñɾ ......
ERROR 1005 (HY000): Can't create table ' ****.frm' (errno: 150)
ÎÒÊÇ´ÓÒÔϼ¸¸ö·½Ãæ½â¾öÁË´ËÎÊÌ⣺
1¡¢È·±£²ÎÕյıíºÍ×Ö¶ÎÊÇ´æÔڵģ»
2¡¢×é³ÉÍâ¼üµÄ×Ö¶ÎÒªÇó±»Ë÷Òý(Ö÷ÒªÊÇÍâ¼üÄǸö×Ö¶ÎÒªÇóÔÚÆäËû±íÖÐÊÇÖ÷¼ü)£»
3¡¢Íâ¼ü¹ØÁªµÄÁ½±í»ò¶à±íÒªÇó¶¼ÊÇINNODBÀàÐÍµÄ±í£»
4¡¢×Ö¶ÎÀàÐÍ£¨ËµÃ÷£©ÒªÒ»Ñù`itemId` varchar( ......
µ¼³ö
select field1,field2,field3 from tablename into outfile '/home/output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '\n';
µ¼Èë
load data local infile '/home/output1.csv' into table tablename fields terminated by ','lines terminated by '\n'(field1,f ......