MySQLÐÔÄÜÓÅ»¯
1. ¼ò½é
ÔÚWebÓ¦ÓóÌÐòÌåϵ¼Ü¹¹ÖУ¬Êý¾Ý³Ö¾Ã²ã£¨Í¨³£ÊÇÒ»¸ö¹ØϵÊý¾Ý¿â£©ÊǹؼüµÄºËÐIJ¿·Ö£¬Ëü¶ÔϵͳµÄÐÔÄÜÓзdz£ÖØÒªµÄÓ°Ïì¡£MySQLÊÇĿǰʹÓÃ×î¶àµÄ¿ªÔ´Êý¾Ý¿â£¬µ«ÊÇMySQLÊý¾Ý¿âµÄĬÈÏÉèÖÃÐÔÄܷdz£µÄ²î£¬½ö½öÊÇÒ»¸öÍæ¾ßÊý¾Ý¿â¡£Òò´ËÔÚ²úÆ·ÖÐʹÓÃMySQLÊý¾Ý¿â±ØÐë½øÐбØÒªµÄÓÅ»¯¡£
ÓÅ»¯ÊÇÒ»¸ö¸´ÔÓµÄÈÎÎñ£¬±¾ÎÄÃèÊöMySQLÏà¹ØµÄÊý¾Ý¿âÉè¼ÆºÍ²éѯÓÅ»¯£¬·þÎñÆ÷¶ËÓÅ»¯£¬´æ´¢ÒýÇæÓÅ»¯¡£
2. Êý¾Ý¿âÉè¼ÆºÍ²éѯÓÅ»¯
ÔÚMySQL
ServerÐÔÄܵ÷ÓÅÖУ¬Ê×ÏÈÒª¿¼ÂǵľÍÊÇDatabase SchemaÉè¼Æ£¬ÕâÒ»µãÊǷdz£ÖØÒªµÄ¡£Ò»¸öÔã¸âµÄSchemaÉè¼Æ¼´Ê¹ÔÚÐÔÄܵ÷ÓŵÄMySQL
ServerÉÏÔËÐУ¬Ò²»á±íÏÖ³öºÜ²îµÄÐÔÄÜ£»ºÍSchemaÏàËÆ£¬²éѯÓï¾äµÄÉè¼ÆÒ²»áÓ°ÏìMySQLµÄÐÔÄÜ£¬Ó¦¸Ã±ÜÃâд³öµÍЧµÄSQL²éѯ¡£ÕâÒ»½Ú½«ÏêϸÌÖÂÛÕâÁ½·½ÃæµÄÓÅ»¯¡£
2.1 Schema Design
SchemaµÄÓÅ»¯È¡¾öÓÚ½«ÒªÔËÐÐʲôÑùµÄquery£¬²»Í¬µÄquery»áÓв»Í¬µÄSchemaÓÅ»¯·½°¸¡£2.2½Ú½«½éÉÜQuery
DesignµÄÓÅ»¯¡£SchemaÉè¼ÆͬÑùÊܵ½Ô¤ÆÚÊý¾Ý¼¯´óСµÄÓ°Ïì¡£SchemaÉè¼ÆʱÖ÷Òª¿¼ÂÇ£º±ê×¼»¯£¬Êý¾ÝÀàÐÍ£¬Ë÷Òý¡£
2.1.1 ±ê×¼»¯
±ê×¼»¯ÊÇÔÚÊý¾Ý¿âÖÐ×éÖ¯Êý¾ÝµÄ¹ý³Ì¡£ÆäÖаüÀ¨£¬¸ù¾ÝÉè¼Æ¹æÔò´´½¨±í²¢ÔÚÕâЩ±í¼ä½¨Á¢¹Øϵ£»Í¨¹ýÈ¡ÏûÈßÓà¶ÈÓë²»Ò»ÖÂÏà¹ØÐÔ£¬¸ÃÉè¼Æ¹æÔò¿ÉÒÔͬʱ±£»¤Êý¾Ý²¢Ìá¸ßÊý¾ÝµÄÁé»îÐÔ¡£Í¨³£Êý¾Ý¿â±ê×¼»¯ÊÇÈÃÊý¾Ý¿âÉè¼Æ·ûºÏijһ¼¶±ðµÄ·¶Ê½£¬Í¨³£Âú×ãµÚÈý·¶Ê½¼´¿É¡£Ò²ÓеÚËÄ·¶Ê½£¨Ò²³ÆΪ
Boyce
Codd·¶Ê½£¬BCNF)£©ÓëµÚÎ巶ʽ´æÔÚ£¬µ«ÊÇÔÚʵ¼ÊÉè¼ÆÖкÜÉÙ¿¼ÂÇ¡£ºöÊÓÕâЩ¹æÔò¿ÉÄÜʹµÃÊý¾Ý¿âµÄÉè¼Æ²»Ì«ÍêÃÀ£¬µ«Õâ²»Ó¦Ó°Ï칦ÄÜ¡£
±ê×¼»¯µÄÌص㣺
1) ËùÓеē¶ÔÏ󔶼ÔÚËü×Ô¼ºµÄtableÖУ¬Ã»ÓÐÈßÓà¡£
2) Êý¾Ý¿âͨ³£ÓÉE-RͼÉú³É¡£
3)
¼ò½à£¬¸üÐÂÊôÐÔͨ³£Ö»ÐèÒª¸üкÜÉٵļǼ¡£
4) Join²Ù×÷±È½ÏºÄʱ¡£
5) Select£¬sortÓÅ»¯´ëÊ©±È½ÏÉÙ¡£
6)
ÊÊÓÃÓÚOLTPÓ¦Óá£
·Ç±ê×¼»¯µÄÌص㣺
1) ÔÚÒ»ÕűíÖд洢ºÜ¶àÊý¾Ý£¬Êý¾ÝÈßÓà¡£
2) ¸üÐÂÊý¾Ý¿ªÏúºÜ´ó£¬¸üÐÂÒ»¸öÊôÐÔ¿ÉÄÜ»á¸üкܶà±í£¬ºÜ¶à¼Ç¼¡£
3)
ÔÚɾ³ýÊý¾ÝÊÇÓпÉÄܶªÊ§Êý¾Ý¡£
4) Select£¬orderÓкܶàÓÅ»¯µÄÑ¡Ôñ¡£
5) ÊÊÓÃÓÚDSSÓ¦Óá£
±ê×¼»¯ºÍ·Ç±ê×¼»¯¶¼Óи÷×ÔµÄÓÅȱµã£¬Í¨³£ÔÚÒ»¸öÊý¾Ý¿âÉè¼ÆÖпÉÒÔ»ìºÏʹÓã¬Ò»²¿·Ö±í¸ñ±ê×¼»¯£¬Ò»²¿·Ö±í¸ñ±£ÁôһЩÈßÓàÊý¾Ý£º
1) ¶ÔOLTPʹÓñê×¼»¯£¬¶ÔDSSʹÓ÷DZê×¼»¯
2)
ʹÓÃÎﻯÊÓͼ¡£MySQL²»Ö±½ÓÖ§³Ö¸ÃÊý¾Ý¿âÌØÐÔ£¬µ«ÊÇ¿ÉÒÔÓÃMyISAM±í´úÌæ¡£
3)
ÈßÓàһЩÊý¾ÝÔÚ±í¸ñÖУ¬ÀýÈ罫ref_idºÍname
Ïà¹ØÎĵµ£º
MYSQL³£ÓÃÃüÁîÁбí
1¡¢ÏµÍ³¹ÜÀí
mysql -hÖ÷»úµØÖ· -uÓû§Ãû -p
Á¬½ÓMYSQL£¨ÔÚmysql/bin£©
exit
Í˳öMYSQLÃüÁî
mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë passwordÐÂÃÜÂë
ÐÞ¸ÄÃÜÂ루ÔÚmysql/bin£©
grantselect[insert][,update][,delete]onÊý¾Ý¿â.*toÓû§Ãû@localhost£¨"%"£¬ ±íʾÈκÎÖ÷»ú£©identifiedby " ......
mysql³£ÓÃÃüÁî
¹Ø±ÕÊý¾Ý¿â
/data01/mysql/bin/mysqladmin -p shutdown
µ¼³öÊý¾Ý¿â
/usr/local/mysql/bin/mysqldump -opt -uroot -p -h10.15.0.45 bbsdb > 20070918.bbsdb.sql
µ¼ÈëÊý¾Ý¿â
/usr/local/mysql/bin/mysql target_db_name < backup-file.sql
ÏÞÖÆÖ»ÓÐÄÚ²¿ip¿ÉÒÔÁ´½Ó
/u ......
1. ÔÚÆäËü»úÆ÷ÉÏÊ×ÏÈ°²×°ºÃÐèÒªµÄmysql ºÍ¶ÔÓ¦µÄ¹ÜÀíÈí¼þ£¨ÉèÖõÄÃÜÂëºÍÔ´Êý¾Ý¿âÃÜÂëÒ»Ö£©
2. ½«Ô´»úÆ÷ÉÏdataϵÄÊý¾Ý¿âÎļþ¼Ð£¨ÒÔÎҵĻúÆ÷ΪÀý£¬¾ÍÊÇrubberFactoryÎļþ¼Ð£¬ÆäÖУ¬
Õâ¸öÎļþ¼ÐϵÄÊý¾ÝÎļþ¶¼ÊÇһЩ±í½á¹¹¶¨Ò壩¿½±´µ½Ä ......
1¡¢Ð½¨±ítest create table test1( field1 int not null ) ENGINE=MyISAM DEFAULT CHARSET=gbk; insert into test1(field1) values(1); 2¡¢É¾³ýÒÑ´æÔڵĴ洢¹ý³Ì -- ɾ³ý´¢´æ¹ý³Ì delimiter // -- ¶¨Òå½áÊø·ûºÅ drop procedure p_test; 3¡¢mysql´æ´¢¹ý³Ì¶¨
1¡¢Ð½¨±ítest
create table test1(
field1 int not null
)
......