Django ʹÓÃMYSQLÊý¾Ý¿â Latin1
¹«Ë¾mysqlͳһÓÃlatin1µÄ±àÂ룬ÕæÊǽÐÈ˿಻¿°ÑÔ¡£DjangoÓÃĬÈÏUTF8·ÃÎÊMYSQLÊý¾Ý¿â¡£ÔÚ²Ù×÷Êý¾Ý¿âʱ£¬²»¹ÜÄãÔõôתÂ룬×îÖÕдµ½Êý¾Ý¿âÀïµÄÖÐÎĶ¼ÊÇÂÒÂë¡£ÔÚÍøÉÏÕÒÁ˺ܾã¬Ò²Ã»½â¾öÕâ¸öÎÊÌâ¡£
ºóÀ´¿´ÁËÒ»¸öDJANGOµÄMYSQL²Ù×÷µÄÔ´Â룬·¢ÏÖÁËһЩÎÊÌâ ÏÈÊÇ/django/db/backends/mysql/base.py ÎļþµÄ 257 µ½263ÐÐ
def _cursor(self):
if not self._valid_connection():
kwargs = {
'conv': django_conversions,
'charset': 'utf8',
'use_unicode': True,
}
¹Ø¼üÔÚÕâÁ½ÐÐ2def _cursor(self):
261 'charset': 'utf8',
262 'use_unicode': True,
Õâ˵Ã÷£¬²Ù×÷Êý¾Ý¿âÓõÄÊÇͨÓñàÂëutf8 ¶øÇÒÊÇÓ²±àÂë½øÈ¥µÄ¡£Èç¹ûÎÒÒ²Ó²±àÂë¸ÄÕâÀïµÄ»°£¬ÒÔºóÓÐUTF8µÄ¿âµÄ»°£¬¾ÍÔã¸âÁË¡£ËùÒÔÒªÏë°ì·¨½«ÕâÁ½Ïîдµ½ÅäÖÃÎļþÀï¡£ËùÒÔѡעÊ͵ôÕâÁ½ÐС£ÔÚsettings_dict = self.settings_dict ÕâÐÐÏÂÃæÌí¼ÓÈçϵĴúÂë
if settings_dict['USE_UNICODE']:
kwargs['use_unicode'] = settings_dict['USE_UNICODE']
else:
kwargs['use_unicode'] = True
if settings_dict['DATABASE_CHARSET']:
kwargs['charset'] = settings_dict['DATABASE_CHARSET']
ÐÞ¸Äsettings.py ¼ÓÈëÈçÏÂÁ½ÐÐ
TEST_DATABASE_CHARSET = 'latin1'
USE_UNICODE = False
µ«ÕâÑù¸ÄÁËÖ®ºó£¬»áÕÒ²»µ½DATABASE_CHARSETºÍUSE_UNICODE Õâ˵Ã÷ÔÚÅäÖÃת½øÀ´Ö®Ç°×öÁËɸѡ£¬ÔÙ¼ÌÐø¿´Õâ¸öÎļþ/django/db/__init__.py »á¿´µ½ÕâÑùµÄ´úÂë
connection = backend.DatabaseWrapper({
'DATABASE_HOST': settings.DATABASE_HOST,
'DATABASE_NAME': settings.DATABASE_NAME,
'DATABASE_OPTIONS': settings.DATABASE_OPTIONS,
'DATABASE_PASSWORD': settings.DATABASE_PASSWORD,
'DATABASE_PORT': settings.DATABASE_PORT,
'DATABASE_USER': settings.DATABASE_USER,
'TIME_ZONE':
Ïà¹ØÎĵµ£º
MySQLÒ×ѧÒ×Óã¬ÇÒ¸½´ø·á¸»µÄ¼¼ÊõÎĵµ£¬Õâ¶þ¸öÒòËØʹ֮±»¹ã·ºÓ¦Óá£È»¶ø£¬Ëæ×ÅMySQL·¢Õ¹Ö®Ñ¸ËÙ£¬¼´Ê¹Ò»¸öMySQLÀÏÊÖÓÐʱҲ»áΪ¸ÃÈí¼þ³öÆä²»ÒâµÄ¹¦ÄܸÐ̾¡£±¾ÎĽ«ÎªÄã½éÉÜÕâЩ²»ÎªÈËÖªµÄÌØÐÔ¡£
ÒÔXML¸ñʽ²é¿´²éѯ½á¹û
ͨ¹ýʹÓô«Í³—xml
Ñ¡Ïîµ÷ÓÃMySQLÃüÁîÐпͻ§³ÌÐò£¬Äã¿ÉÒÔÒÔXML¸ñʽ(¶ø²»ÊÇ´«Í³µÄÁбíÐÎʽ)À´²é¿´M ......
(1)¡¢back_log£º
ÒªÇó MySQL ÄÜÓеÄÁ¬½ÓÊýÁ¿¡£µ±Ö÷ÒªMySQLÏß³ÌÔÚÒ»¸öºÜ¶Ìʱ¼äÄڵõ½·Ç³£¶àµÄÁ¬½ÓÇëÇó£¬Õâ¾ÍÆð×÷Óã¬È»ºóÖ÷Ï̻߳¨Ð©Ê±¼ä(¾¡¹ÜºÜ¶Ì)¼ì²éÁ¬½Ó²¢ÇÒÆô¶¯Ò»¸öÐÂÏ̡߳£
back_log
ÖµÖ¸³öÔÚMySQLÔÝʱֹͣ»Ø´ðÐÂÇëÇó֮ǰµÄ¶Ìʱ¼äÄÚ¶àÉÙ¸öÇëÇó¿ÉÒÔ±»´æÔÚ¶ÑÕ»ÖС£Ö»ÓÐÈç¹ûÆÚÍûÔÚÒ»¸ö¶Ìʱ¼äÄÚÓкܶàÁ¬½Ó£¬ÄãÐèÒªÔö¼ÓËü ......
mysqlµ¼³ösql½Å±¾ ÊÕ²Ø
×¢ÒâÊÂÏî:
*±ØÐëÔÚD:\LTSOFT\MYSQL4\bin> mysqldump -u root -p test > c:\a.sql
ÏȵýøÈëmysql°²×°Ä¿Â¼µÄbinÏ£¨¿ÉÒÔ¿´µ½ÀïÃæÓÐmysqldump.exe£©£¬Í¨³£mysqlĬÈÏ°²×°ÔÚC:\Program Files\MySQL\MySQL Server 5.0
* ²»ÄܽøÈëmysql ÃüÁîÀï.
MySQLµ¼³ ......
DELIMITER $$
DROP PROCEDURE IF EXISTS `heli`.`prodtest` $$
CREATE PROCEDURE `heli`.`prodtest` ()
BEGIN
/*¾Ö²¿±äÁ¿µÄ¶¨Òå declare*/
declare pid varchar(45) default '';
declare pq int default 0;
declare pk double default 0.0;
declare cur1 CURSOR FOR SELECT pro ......
MySQLÓï¾äÓÅ»¯µÄ»ù±¾ÔÔò£º
¡ô1¡¢Ê¹ÓÃË÷ÒýÀ´¸ü¿ìµØ±éÀú±í¡£
ȱʡÇé¿öϽ¨Á¢µÄË÷ÒýÊÇ·ÇȺ¼¯Ë÷Òý£¬µ«ÓÐʱËü²¢²»ÊÇ×î¼ÑµÄ¡£ÔÚ·ÇȺ¼¯Ë÷ÒýÏ£¬Êý¾ÝÔÚÎïÀíÉÏËæ»ú´æ·ÅÔÚÊý¾ÝÒ³ÉÏ¡£ºÏÀíµÄË÷ÒýÉè¼ÆÒª½¨Á¢ÔÚ¶Ô¸÷ÖÖ²éѯµÄ·ÖÎöºÍÔ¤²âÉÏ¡£Ò»°ãÀ´Ëµ£º
a.ÓдóÁ¿Öظ´Öµ¡¢ÇÒ¾³£Óз¶Î§²éѯ£¨ > ,< £¬> =,& ......