Ó°ÏìMysqlÐÔÄܵļ¸¸öÖØÒª²ÎÊý˵Ã÷
innodb_buffer_pool_size
Èç¹ûÓÃInnodb£¬ÄÇôÕâÊÇÒ»¸öÖØÒª±äÁ¿¡£Ïà¶ÔÓÚMyISAMÀ´Ëµ£¬Innodb¶ÔÓÚbuffer size¸üÃô¸Ð¡£MySIAM¿ÉÄܶÔÓÚ´óÊý¾ÝÁ¿Ê¹ÓÃĬÈϵÄkey_buffer_sizeÒ²»¹ºÃ£¬µ«InnodbÔÚ´óÊý¾ÝÁ¿Ê±ÓÃĬÈÏÖµ¾Í¸Ð¾õÔÚÅÀÁË¡£ InnodbµÄ»º³å³Ø»á»º´æÊý¾ÝºÍË÷Òý£¬ËùÒÔ²»ÐèÒª¸øϵͳµÄ»º´æÁô¿Õ¼ä£¬Èç¹ûÖ»ÓÃInnodb£¬¿ÉÒÔ°ÑÕâ¸öÖµÉèΪÄÚ´æµÄ70%-80%¡£ºÍ key_bufferÏàͬ£¬Èç¹ûÊý¾ÝÁ¿±È½ÏСҲ²»ÔõôÔö¼Ó£¬ÄÇô²»Òª°ÑÕâ¸öÖµÉèÌ«¸ßÒ²¿ÉÒÔÌá¸ßÄÚ´æµÄʹÓÃÂÊ¡£
innodb_additional_pool_size
Õâ¸öµÄЧ¹û²»ÊǺÜÃ÷ÏÔ£¬ÖÁÉÙÊǵ±²Ù×÷ϵͳÄܺÏÀí·ÖÅäÄÚ´æʱ¡£µ«Äã¿ÉÄÜÈÔÐèÒªÉè³É20M»ò¸ü¶àÒ»µãÒÔ¿´Innodb»á·ÖÅä¶àÉÙÄÚ´æ×öÆäËûÓÃ;¡£
innodb_log_file_size
¶ÔÓÚдºÜ¶àÓÈÆäÊÇ´óÊý¾ÝÁ¿Ê±·Ç³£ÖØÒª¡£Òª×¢Ò⣬´óµÄÎļþÌṩ¸ü¸ßµÄÐÔÄÜ£¬µ«Êý¾Ý¿â»Ö¸´Ê±»áÓøü¶àµÄʱ¼ä¡£ÎÒÒ»°ãÓÃ64M-512M£¬¾ßÌåÈ¡¾öÓÚ·þÎñÆ÷µÄ¿Õ¼ä¡£
innodb_log_buffer_size
ĬÈÏÖµ¶ÔÓÚ¶àÊýÖеÈд²Ù×÷ºÍÊÂÎñ¶ÌµÄÔËÓö¼ÊÇ¿ÉÒԵġ£Èç¹û¾³£×ö¸üлòÕßʹÓÃÁ˺ܶàblobÊý¾Ý£¬Ó¦¸ÃÔö´óÕâ¸öÖµ¡£µ«Ì«´óÁËÒ²ÊÇÀË·ÑÄڴ棬ÒòΪ1ÃëÖÓ×Ü»á flush£¨Õâ¸ö´ÊµÄÖÐÎÄÔõô˵ÄØ£¿£©Ò»´Î£¬ËùÒÔ²»ÐèÒªÉèµ½³¬¹ý1ÃëµÄÐèÇó¡£8M-16MÒ»°ãÓ¦¸Ã¹»ÁË¡£Ð¡µÄÔËÓÿÉÒÔÉè¸üСһµã¡£
innodb_flush_log_at_trx_commit £¨Õâ¸öºÜ¹ÜÓã©
±§Ô¹Innodb±ÈMyISAMÂý 100±¶£¿ÄÇôÄã´ó¸ÅÊÇÍüÁ˵÷ÕûÕâ¸öÖµ¡£Ä¬ÈÏÖµ1µÄÒâ˼ÊÇÿһ´ÎÊÂÎñÌá½»»òÊÂÎñÍâµÄÖ¸ÁÐèÒª°ÑÈÕ־дÈ루flush£©Ó²ÅÌ£¬ÕâÊǺܷÑʱµÄ¡£ÌرðÊÇʹÓõç³Ø¹©µç»º´æ£¨Battery backed up cache£©Ê±¡£Éè³É2¶ÔÓںܶàÔËÓã¬ÌرðÊÇ´ÓMyISAM±íת¹ýÀ´µÄÊÇ¿ÉÒԵģ¬ËüµÄÒâ˼ÊDz»Ð´ÈëÓ²Å̶øÊÇдÈëϵͳ»º´æ¡£ÈÕÖ¾ÈÔÈ»»áÿÃëflushµ½Ó²ÅÌ£¬ËùÒÔÄãÒ»°ã²»»á¶ªÊ§³¬¹ý1-2ÃëµÄ¸üС£Éè³É0»á¸ü¿ìÒ»µã£¬µ«°²È«·½Ãæ±È½Ï²î£¬¼´Ê¹MySQL¹ÒÁËÒ²¿ÉÄܻᶪʧÊÂÎñµÄÊý¾Ý¡£¶øÖµ2Ö»»áÔÚÕû¸ö²Ù×÷ϵͳ¹ÒÁËʱ²Å¿ÉÄܶªÊý¾Ý¡£
Ïà¹ØÎĵµ£º
¾³£Óõ½£¬µ«ÊÇ×ÜÊǼDz»×¡¡£
Óï·¨ÈçÏ£º
ALTER TABLE JOB ADD CONSTRAINT fk_prono
FOREIGN KEY(PRONO)
REFERENCES PROJECT(PRONO)
ON DELETE CASCADE
ON UPDATE NO ACTION;
ÎÒÔÚmysqlÖÐÌí¼ÓÁËÍâ¼üÔ¼Êø£¬ÊÔÁË°ëÌìû³É¹¦£¬ºóÀ´°ÑÍâ¼üµÄÃû×ÖÓÉFK¸Ä³ÉFK_1¾ÍºÃÁË£¬¿ÉÄÜmysqlÖÐFKÊǸö±£Áô×Ö£¬×¢Ò⣡ ......
--default-character-set=utf8 ÓëÐÞ¸ÄsqlÎļþ¼ÓÈ룺SET NAMES 'utf8';
µ¼Èë½Å±¾Ê±£¬SET NAMES 'xxx' £¬xxxÓ¦¸ÃºÍsql½Å±¾ÎļþµÄʵ¼Ê±àÂëÒ»Ö£¬Èç¹ûÄãÉèÖõÄʱutf-8 £¬ÄÇôÇëÈ·ÈÏÄãµÄsql½Å±¾Îļþʱutf-8±£´æµÄ:
iconv -f UTF-8 xxx.sql
Èç¹ûÏÔʾÕý³££¬ÄÇôÕâÒ»²½¾ÍOKÁË
ÁíÍâ×¢ÒâÄãµÄ½Å±¾ÀÓÐûÓиø¿â±íÉèÖ ......
<>ÕûÀíÁËÒÔÏÂËÄÖÖÔÚMySQLÖÐÐÞ¸ÄrootÃÜÂëµÄ·½·¨,¿ÉÄܶԴó¼ÒÓÐËù°ïÖú!
·½·¨1£º ÓÃSET PASSWORDÃüÁî
¡¡¡¡mysql -u root
¡¡¡¡mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
·½·¨2£ºÓÃmysqladmin
¡¡¡¡mysqladmin -u root password "newpass"
¡¡¡¡Èç¹ûrootÒѾÉèÖà ......
Java ¶ÁÈ¡ MySQL ÖÐÎÄ ÂÒÂë
³¡¾°:Java,eclipse£¬¶ÁÈ¡MySQLÊý¾Ý¿â£¬MySQL±àÂëΪutf-8
ÎÊÌ⣺¶Á³öÀ´µÄÖÐÎÄÔÚeclipseµÄÊä³ö´°¿ÚÖÐÏÔʾΪÂÒÂë
´íÎóµÄд·¨
1
System.out.print(new String( rs.getString("bib_author").getBytes("utf-8"),"GBK" ));
2
System.out.print( ......
MySQLµÄtimestampÀàÐÍ×Ô¶¯¸üÐÂÎÊÌâ
½ñÌ콨ÁËÒ»¸ö±í£¬ÀïÃæÓÐÒ»¸öÁÐÊÇtimestampÀàÐÍ£¬ÎÒ±¾ÒâÊÇÔÚÊý¾Ý¸üÐÂʱ£¬Õâ¸ö×ֶεÄʱ¼äÄÜ×Ô¶¯¸üС£ÆñÖª¶ÔÕâ¸öÀàÐ͵ÄÖµ»¹²»ÉõÁ˽⣬µ¼Ö³ö´í¡£·¢ÏÖÕâ¸ö×Ö¶ÎÖ»ÊÇÔÚÕâÐÐÊý¾Ý½¨Á¢µÄʱºòÓÐÖµ£¬ÔÚ¸üеÄÈ´Îޱ仯¡£
²éÕÒ×ÊÁÏ£¬·¢ÏÖÊÇÎÒ½¨±íµÄÓï¾äÓÐÎÊÌ⣺
ÒÔÏÂÊÇ´ú ......