MYSQL[ÃüÁîÐÐÏÂ]µ¼Èëµ¼³ö´óÊý¾Ý·½·¨£¡
2007-11-16 15:37
½ñÌì¿´×ÅÊÖ²áÊÔÁËÏ£¬·¢ÏÖÔÀ´´óÊý¾Ýµ¼Èëµ¼³öÊÇÄÇôµÄÇáËÉ£¨²»ÊǺܴó£¬200¶àMµÄÎı¾¶øÒÔ£©
×¢Ò⣺Èç¹û·¢ÏÖMYSQL unknown command '\'ÕâÑùµÄÌáʾ£¬ÔòÉèÖÃһϷþÎñÆ÷µÄ×Ö·û¼¯£¬È磺
mysql -uroot -ppasspass --default-character-set=utf8 databaseName <d:bakcup.sql
ÕâÑù¾Í²»»á±¨´íÁË£¬^_^
µ¼³ö£º(mysqldump)
cmd>ϽøÐÐMysqlµÄ°²×°Ä¿Â¼£¬½øÈëbinĿ¼£¡
mysqldump -u root -p database_name > d:backup\bak_sql_name.sql
È»ºó»Ø³µ£¨ÆäÖУ¬-u mysqlµÄÓû§ -pΪÃÜÂë(¿Õ×Å) database_nameΪÐèÒª±¸·ÝµÄÊý¾ÝÃû£¬> ºóÃæ¾ÍÊǵØÖ·ÁË£¡£©
ÏêϸµÄ²ÎÊý£¬¿É¿´¹Ù·½Êֲᣡ
µ¼È룺£¨mysql£©
ÔÚmysqlµÄbinĿ¼Ï£¬¼üÈëmysql -u root -p database_name < d:backup\bak_sql_name.sql
ÌáʾÊäÈëÕýÈ·ÃÜÂë¾ÍOKÁË£¡
Ò²¿ÉÒÔ¼üÈëmysql -u root -p£¨µÇ½mysql¿ØÖÆ̨£¬ÓÃsource»ò\.ÃüÁî½øÐе¼È룡£©
mysql>source d:backup\bak_sql_name.sql
mysql>\. d:bakcup\bak_sql_name.sql
mysqldumpÓ÷¨¼¸Àý
2007/08/24 02:27 P.M.
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
¼¸¸ö³£ÓÃÓÃÀý£º
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.µ¼³öÒ»¸ö±í
mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:\wcnc_db.sql
-d ûÓÐÊý¾Ý --add-drop-table ÔÚÿ¸öcreateÓï¾ä֮ǰÔö¼ÓÒ»¸ödrop table
4.´øÓïÑÔ²ÎÊýµ¼³ö
mysqldump -uroot -p --default-character-set=latin1 --set-charset=gbk --skip-opt databse > d4.sql
5.µ¼ÈëÊý¾Ý¿â
³£ÓÃsource ÃüÁî
½øÈëmysqlÊý¾Ý¿â¿ØÖÆ̨£¬
Èçmysql -u root -p
mysql>use Êý¾Ý¿â
È»ºóʹÓÃsourceÃüÁºóÃæ²ÎÊýΪ½Å±¾Îļþ£¨ÈçÕâÀïÓõ½µÄ.sql£©
mysql>source d:\wcnc_db.sql
mysqldumpÖ§³ÖÏÂÁÐÑ¡Ï
–add-locks
ÔÚÿ¸ö±íµ¼³ö֮ǰÔö¼ÓLOCK TABLES²¢ÇÒÖ®ºóUNLOCK TABLE¡£(ΪÁËʹµÃ¸ü¿ìµØ²åÈ
Ïà¹ØÎĵµ£º
ÖÕÓÚÈ÷þÎñÆ÷ÿÌìÔçÉϱ¸·ÝÒ»´Î MySQL Êý¾Ý¿â²¢×Ô¶¯´ò°ü,ͬʱɾ³ý 5 ÌìÇ°µÄ±¸·ÝÎļþ. ·ÖÏíÈçÏÂ.
1. »·¾³: windows server 2003 + Apache 2.0 + PHP5 + MySQL 4.0.26 .
2. ¼ÙÉè PHP °²×°Ä¿Â¼Îª D:/php ,MySQL °²×°Ä¿Â¼Îª D:/mysql.
3. ÔÚ D:/php Ͻ¨Á¢Ä¿Â¼ WinRAR, °ÑÄã winrar °²×°Ä¿Â¼Ï嵀 WinRAR.exe ºÍ RARReg.KEY ¸´ ......
MySQLË÷Òýͨ³£ÊDZ»ÓÃÓÚÌá¸ßWHEREÌõ¼þµÄÊý¾ÝÐÐÆ¥Åä»òÕßÖ´ÐÐÁª½á²Ù×÷ʱƥÅäÆäËü±íµÄÊý¾ÝÐеÄËÑË÷Ëٶȡ£
MySQLÒ²ÄÜÀûÓÃË÷ÒýÀ´¿ìËÙµØÖ´ÐÐORDER BYºÍGROUP BYÓï¾äµÄÅÅÐòºÍ·Ö×é²Ù×÷¡£
ͨ¹ýË÷ÒýÓÅ»¯À´ÊµÏÖMySQLµÄORDER BYÓï¾äÓÅ»¯£º
1¡¢ORDER BYµÄË÷ÒýÓÅ»¯¡£Èç¹ûÒ»¸öSQLÓï¾äÐÎÈ磺
SELECT [column1],[column2],…. fro ......
µ±ÓÃshow processlist;¿´µ½ÈçÏÂÐÅϢʱ:
LL | login | NULL |
| 697 | unauthenticated user | 218.26.219.186:26944 | NULL | Connect | NULL | login | NULL & ......
http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//Ö÷¼ü549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint n ......