Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL ±¸·ÝºÍ»Ö¸´

±¾ÎÄÌÖÂÛ MySQL µÄ±¸·ÝºÍ»Ö¸´»úÖÆ£¬ÒÔ¼°ÈçºÎά»¤Êý¾Ý±í£¬°üÀ¨×îÖ÷ÒªµÄÁ½ÖÖ±íÀàÐÍ£ºMyISAM ºÍ Innodb£¬ÎÄÖÐÉè¼ÆµÄ MySQL °æ±¾Îª 5.0.22¡£
Ä¿Ç° MySQL Ö§³ÖµÄÃâ·Ñ±¸·Ý¹¤¾ßÓУºmysqldump¡¢mysqlhotcopy£¬»¹¿ÉÒÔÓà SQL Óï·¨½øÐб¸·Ý£ºBACKUP TABLE »òÕß SELECT INTO OUTFILE£¬ÓÖ»òÕß±¸·Ý¶þ½øÖÆÈÕÖ¾£¨binlog£©£¬»¹¿ÉÒÔÊÇÖ±½Ó¿½±´Êý¾ÝÎļþºÍÏà¹ØµÄÅäÖÃÎļþ¡£MyISAM ±íÊDZ£´æ³ÉÎļþµÄÐÎʽ£¬Òò´ËÏà¶Ô±È½ÏÈÝÒ×±¸·Ý£¬ÉÏÃæÌáµ½µÄ¼¸ÖÖ·½·¨¶¼¿ÉÒÔʹÓá£Innodb ËùÓÐµÄ±í¶¼±£´æÔÚͬһ¸öÊý¾ÝÎļþ ibdata1 ÖУ¨Ò²¿ÉÄÜÊǶà¸öÎļþ£¬»òÕßÊǶÀÁ¢µÄ±í¿Õ¼äÎļþ£©£¬Ïà¶ÔÀ´Ëµ±È½Ï²»ºÃ±¸·Ý£¬Ãâ·ÑµÄ·½°¸¿ÉÒÔÊÇ¿½±´Êý¾ÝÎļþ¡¢±¸·Ý binlog£¬»òÕßÓà mysqldump¡£
1¡¢mysqldump
1.1 ±¸·Ý
mysqldump ÊDzÉÓÃSQL¼¶±ðµÄ±¸·Ý»úÖÆ£¬Ëü½«Êý¾Ý±íµ¼³É SQL ½Å±¾Îļþ£¬ÔÚ²»Í¬µÄ MySQL °æ±¾Ö®¼äÉý¼¶Ê±Ïà¶Ô±È½ÏºÏÊÊ£¬ÕâÒ²ÊÇ×î³£Óõı¸·Ý·½·¨¡£
ÏÖÔÚÀ´½²Ò»Ï mysqldump µÄһЩÖ÷Òª²ÎÊý£º
--compatible=name
Ëü¸æËß mysqldump£¬µ¼³öµÄÊý¾Ý½«ºÍÄÄÖÖÊý¾Ý¿â»òÄĸö¾É°æ±¾µÄ MySQL ·þÎñÆ÷Ïà¼æÈÝ¡£Öµ¿ÉÒÔΪ ansi¡¢mysql323¡¢mysql40¡¢postgresql¡¢oracle¡¢mssql¡¢db2¡¢maxdb¡¢no_key_options¡¢no_tables_options¡¢no_field_options µÈ£¬ÒªÊ¹Óü¸¸öÖµ£¬ÓöººÅ½«ËüÃǸô¿ª¡£µ±È»ÁË£¬Ëü²¢²»±£Ö¤ÄÜÍêÈ«¼æÈÝ£¬¶øÊǾ¡Á¿¼æÈÝ¡£
--complete-insert£¬-c
µ¼³öµÄÊý¾Ý²ÉÓðüº¬×Ö¶ÎÃûµÄÍêÕû INSERT ·½Ê½£¬Ò²¾ÍÊÇ°ÑËùÓеÄÖµ¶¼Ð´ÔÚÒ»ÐС£Õâô×öÄÜÌá¸ß²åÈëЧÂÊ£¬µ«ÊÇ¿ÉÄÜ»áÊܵ½ max_allowed_packet ²ÎÊýµÄÓ°Ïì¶øµ¼Ö²åÈëʧ°Ü¡£Òò´Ë£¬ÐèÒª½÷É÷ʹÓøòÎÊý£¬ÖÁÉÙÎÒ²»ÍƼö¡£
--default-character-set=charset
Ö¸¶¨µ¼³öÊý¾Ýʱ²ÉÓúÎÖÖ×Ö·û¼¯£¬Èç¹ûÊý¾Ý±í²»ÊDzÉÓÃĬÈ쵀 latin1 ×Ö·û¼¯µÄ»°£¬ÄÇôµ¼³öʱ±ØÐëÖ¸¶¨¸ÃÑ¡Ï·ñÔòÔٴε¼ÈëÊý¾Ýºó½«²úÉúÂÒÂëÎÊÌâ¡£
--disable-keys
¸æËß mysqldump ÔÚ INSERT Óï¾äµÄ¿ªÍ·ºÍ½áβÔö¼Ó /*!40000 ALTER TABLE table DISABLE KEYS */; ºÍ /*!40000 ALTER TABLE table ENABLE KEYS */; Óï¾ä£¬ÕâÄÜ´ó´óÌá¸ß²åÈëÓï¾äµÄËٶȣ¬ÒòΪËüÊÇÔÚ²åÈëÍêËùÓÐÊý¾Ýºó²ÅÖؽ¨Ë÷ÒýµÄ¡£¸ÃÑ¡ÏîÖ»ÊÊºÏ MyISAM ±í¡£
--extended-insert = true|false
ĬÈÏÇé¿öÏ£¬mysqldump ¿ªÆô --complete-insert ģʽ£¬Òò´Ë²»ÏëÓÃËüµÄµÄ»°£¬¾ÍʹÓñ¾Ñ¡ÏÉ趨ËüµÄֵΪ false ¼´¿É¡£
--hex-blob
ʹÓÃÊ®Áù½øÖƸñʽµ¼³ö¶þ½øÖÆ×Ö·û´®×ֶΡ£Èç¹ûÓжþ½øÖÆÊý¾Ý¾Í±ØÐëʹÓñ¾Ñ¡Ïî¡£Ó°Ïìµ½µÄ×Ö¶ÎÀàÐÍÓÐ BINARY¡¢VARBINARY¡¢BLO


Ïà¹ØÎĵµ£º

MYSQL¹ØÓÚ×Ö·û±àÂë·½ÃæµÄ´æ´¢Ô­Àí

    * mysqlÊ×ÏȽ«Äõ½µÄÊý¾Ýת»»Îªcharacter_set_clientÖ¸¶¨µÄ±àÂë¸ñʽ£¬È»ºóת»»Îª character_set_connectionÖ¸¶¨µÄ¸ñʽ£¬×îºóÔÙ½«Êý¾Ý´æ´¢µ½Êý¾Ý¿â£¬´æ´¢¸ñʽΪcharacter_set_databaseËùÖ¸¶¨µÄ¸ñʽ£»
    * ´ÓÊý¾Ý¿â¶ÁÊý¾Ýʱ£¬½«Êý¾Ý¿â¸ñʽת»»Îªcharacter_set_resultsÖ¸¶¨µÄ¸ñʽ£¬ÔÙ·¢Ë ......

mysql´æÖü¹ý³Ì

## **********first test,procedure**********
#<1>
use testprocedure;
delimiter //
create procedure simpleproce1 (out par1 int)
begin
 select count(*) into par1 from proce;
end
//
delimiter ;
call simpleproce1(@a);
select @a;
#<2>,ÿ´ÎÖ»Óе¥Ò»µÄÐпÉÒÔ±»È¡»Øselect id,name i ......

linux mysql ¿ª·¢»·¾³

°²×°mysql
sudo apt-get install mysql-servel-5.0 mysql-client-5.0
ÏÂÔØ°²×°¹ý³ÌÖУ¬»áÌáʾÊäÈërootÃÜÂë
°²×°CÓïÑÔ±à³Ì½Ó¿Ú£º
 sudo apt-get install libmysqlclient15-dev
¸ü¶àapi ²é¿´£ºhttp://dev.mysql.com/doc/refman/5.0/en/c.html
Ïà¹ØmysqlÍ·ÎļþºÍ¿âÎļþ°²×°ÔÚ/usr/include/mysql/ºÍ/usr/lib/mysqlÄ¿ ......

MySQL³£ÓòÙ×÷»ù±¾²Ù×÷


¹Ø¼ü×Ö: mysql³£ÓòÙ×÷»ù±¾²Ù×÷
MySQL³£ÓòÙ×÷»ù±¾²Ù×÷£¬ÒÔ϶¼ÊÇMySQL5.0ϲâÊÔͨ¹ýÊ×ÏÈ˵Ã÷Ï£¬¼ÇסÔÚÿ¸öÃüÁî½áÊøʱ¼ÓÉÏ£»£¨·ÖºÅ£©
1.µ¼³öÕû¸öÊý¾Ý¿â
mysqldump -u Óû§Ãû -p --default-character-set=latin1 Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû(Êý¾Ý¿âĬÈϱàÂëÊÇlatin1)
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc. ......

MySQL 4.1(»òÒÔÉÏ) ÖÐÎÄÂÒÂëÔ­Òò¼°½â¾ö·½·¨

ºÜ¶àÅóÓѶ¼ÓйýÕâÑùµÄ¾­Àú,½«mysqlÉý¼¶µ½4.1(»òÒÔÉÏ)°æ±¾ºó,¾ÉµÄ³ÌÐò´ÓÊý¾Ý¿â¶Á³öÀ´µÄ¶¼±ä³ÉÂÒÂëÁË.Õâ¸öÎÊÌâÍøÉϺܶàÕâ·½ÃæµÄÌÖÂÛ,ÆäʵÊÖ²áÉÏÒѾ­ÓйØÓÚÕâ·½ÃæµÄÏêϸ˵Ã÷,
ÒÔÏÂÄÚÈÝÕª×ÔmysqlÊÖ²á,
²úÉúÕâ¸öÎÊÌâµÄÔ­ÒòÊÇ:
MySQL 4.1.x¿ªÊ¼Ö§³ÖÒÔÏÂÕâЩÊÂÇé
·         ʹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ