MysqlʹÓÃ×ܽá
±ÏÒµÉè¼ÆµÄ³ÌÐòÖ÷Ìå±àºÃÁË£¬ÔËÐÐÉÙÁ¿Êý¾ÝûÓÐÈκÎÎÊÌ⣬һµ©Êý¾ÝÁ¿Ôö¼Óµ½22w£¬ÔËÐÐʱ¼ä¾Í³¤µÃÁîÈË·¢Ö¸¡£µ¼Ê¦½¨Ò飬³ÌÐòÖо¡¿ÉÄܵؼõÉÙÓëÊý¾Ý¿â½»»¥µÄ´ÎÊý£¬¾¡¿ÉÄܵذѹ¤×÷¶ª¸øÊý¾Ý¿âÍê³É¡£ÔÚÕâһ˼ÏëµÄÖ¸µ¼Ï£¬ÎÒÈýÌì´ó·ùÐ޸ijÌÐò£¬²¿·Ö´úÂ뼸ºõÊÇ·ÐÂÁËÒ»±é¡£×ܵÄÀ´Ëµ£¬ÔËÐÐʱ¼äȷʵµÃµ½Á˺ܴóµÄ¸ÄÉÆ£¬°ÑÕâÈýÌìµÄ¾Ñé×ܽáһϡ£
1¡¢update²Ù×÷
ʹÓÃpreparestatementÒÔbatch·½Ê½Ìá½»¡£Ä³¸ö²Ù×÷µÄÔËÐÐʱ¼ä´Ó12minËõ¼õµ½82s¡£
2¡¢½¨Á¢Ë÷Òý
Èç¹ûʹÓÃselect from whereµÄ²Ù×÷£¬Ò»¶¨ÒªÎªwhereºóµÄÊôÐÔ½¨Á¢Ë÷Òý¡£·ñÔòÔÚ´ó±íÉϽøÐд˲Ù×÷£¬Ê±¼ä·Ç³£³¤¡£Èç¹ûÓÃ
show processlist²é¿´£¬·¢ÏÖqueryµÄ״̬³¤Ê±¼äÍ£ÁôÔÚsending data¡£ËùÒÔ½¨Ë÷ÒýºÜÖØÒª¡£
3¡¢distinct
×îºÃ²»ÒªÓÃdistinct²Ù×÷£¬·Ç³£ºÄʱ¡£ÎÒ×î³õµÄ´æ´¢¹ý³Ì¼°´úÂëÀ¶¼¶à´ÎÓõ½select count(distinct attribute)£¬Ê¹µÃqueryÖ´
ÐеÄʱ¼ä·Ç³£³¤¡£ÍøÉÏÓн¨Ò飬Èç¹ûÓï¾äΪ select count(distinct attribute) from table_name where,¿ÉÒÔÓÅ»¯Îª
select count(distinct attribute) from (select attribute from table_name where ) as t£¬ tÊÇtable_nameµÄ±ðÃû¡£
4¡¢´æ´¢¹ý³Ì
ÓαêÉêÃ÷ºó£¬Ã»Óдò¿ªÊ±£¬²»ÄÜʹÓÃselect into²Ù×÷£¬ÓнâÊÍ˵select intoÆäʵÊÇÒ»¸öÒþʽÓαꡣËùÓÐÎÒ Ö»ºÃ°Ñselect intoд½ø
ÁËÓαêµÄÑ»·Àï¡£µÈÏÂÒªÔÙÊÔÒ»ÊÔ£¬ÔÚopen cursorºÍfetchÖ®¼ä£¬Ð´Èëselect into£¬¿´ÊÇ·ñÄܹ»³É¹¦¡£
&nbs
Ïà¹ØÎĵµ£º
ÔÚrootÕ˺ÅÖÐ,¿ÉÒÔÕý³£µ÷Óô洢¹ý³Ì.
»»µ½common_userÕ˺Åʱ,ͬһ´æ´¢¹ý³ÌÃûµ÷ÓóöÏÖÎÊÌâ.
×·×Ùµ÷ÊÔʱ³öÏÖ:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
ËÑË÷½â¾ö·½°¸:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;dat ......
[Ô´´] MySQLÊý¾Ý¿â´æ´¢ÒýÇæºÍ·ÖÖ§ÏÖ×´
ÔÚMySQL¾ÀúÁË2008ÄêSunµÄÊÕ¹ººÍ2009ÄêOracleÊÕ¹ºSunµÄ¹ý³ÌÖУ¬»ù±¾´¦ÓÚÍ£ÖÍ·¢Õ¹µÄÇé¿ö£¬ÔÚ¿ÉÒÔÔ¤¼ûµÄδÀ´£¬MySQLÊǿ϶¨»á±»Oracle¸éÖò¢ÇÒÖð²½Ñ©²ØÏûÃðµôµÄ¡£MySQLËæ×ÅÏàÓ¦µÄ¸÷Ö÷´´ºÍÄÚ²¿¿ª·¢ÈËÔ±µÄÀëÈ¥£¬µÞÔìÁ˸÷¸ö²»Í¬µÄÒýÇæºÍ·ÖÖ§£¬ÈÃMySQLÓÐÏ£Íû¼ÌÐø·¢Ñï¹â´óÆðÀ´¡£
±¾ ......
MySQLΪÎÒÃÇÌṩÁ˺ܶà±íÀàÐ͹©Ñ¡Ôñ£¬ÓÐMyISAM¡¢ISAM¡¢HEAP¡¢BerkeleyDB¡¢InnoDB£¬MERGE±íÀàÐÍÿһÖÖ±íÀàÐͶ¼ÓÐÆä×Ô¼ºµÄÊôÐÔºÍÓŵ㡣ÏÂÃæÎÒÃÇÀ´¼òµ¥µÄÌÖÂÛһϡ£
MyISAM±íÀàÐÍ£º
MyISAM
±í(TYPE=MYISAM)ÊÇISAMÀàÐ͵ÄÒ»ÖÖÑÓÉ죬¾ßÓкܶàÓÅ»¯ºÍÔöÇ¿µÄÌØÐÔ¡£ÊÇMySQLµÄĬÈϱíÀàÐÍ¡£MyISAMÓÅ»¯ÁËѹËõ±ÈÀýºÍËٶȣ¬²¢ÇÒ
¿ÉÒ& ......
´´½¨µÄһЩ±í»á³öÏÖÕâÑùµÄÎÊÌ⣺ӢÎIJåÈëµ½±íÖÐûÓÐÈκÎÎÊÌâ¡£µ«ÊDzåÈëÖÐÎĵÄʱºò¾Í³öÏÖ Data truncation: Data too long for column 'name' at row 1 ÀàËƵÄÎÊÌâ¡£
mysqlÄÜ°ÑÓ¢ÎÄ×ֶβåÈçÊý¾Ý¿âÁË¡¡µ±ÎÒÊäÈëÖÐÎÄʱËû¾Í³öÏÖ×Ö¶ÎData truncation: Data too long for column 'name' at row 1
ÎÒʹÓÃÅóÓѵÄÕâ¸ö·½·¨£º(1)ÐÞ¸ ......
UTF8 ĬÈÏУ¶Ô¼¯ÊÇ utf8_general_ci , Ëü²»ÊÇ°´ÕÕÖÐÎÄÀ´µÄ¡£ÄãÐèҪǿÖÆÈÃMySQL°´ÖÐÎÄÀ´ÅÅÐò¡£
select
*
from
core_vender_info
order
by
convert
(vender_abbrev USING gbk) COLLATE gbk_chinese_ci
......