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

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ÃÜÂëºÍÃÜÂëÆƽâµÄ³£Ó÷½·¨

·½·¨Ò»
ʹÓÃphpmyadmin£¬ÕâÊÇ×î¼òµ¥µÄÁË£¬ÐÞ¸Ämysql¿âµÄuser±í£¬²»¹ý±ðÍüÁËʹÓÃPASSWORDº¯Êý¡£
·½·¨¶þ
ʹÓÃmysqladmin£¬ÕâÊÇÇ°ÃæÉùÃ÷µÄÒ»¸öÌØÀý¡£
mysqladmin -u root -p password mypasswd
ÊäÈëÕâ¸öÃüÁîºó£¬ÐèÒªÊäÈërootµÄÔ­ÃÜÂ룬ȻºórootµÄÃÜÂ뽫¸ÄΪmypasswd¡£
°ÑÃüÁîÀïµÄroot¸ÄΪÄãµÄÓû§Ãû£¬Äã¾Í¿ÉÒ ......

MySQLÊ®ÌõÌØÊâ¼¼ÇÉ

MySQLÒ×ѧÒ×Óã¬ÇÒ¸½´ø·á¸»µÄ¼¼ÊõÎĵµ£¬Õâ¶þ¸öÒòËØʹ֮±»¹ã·ºÓ¦Óá£È»¶ø£¬Ëæ×ÅMySQL·¢Õ¹Ö®Ñ¸ËÙ£¬¼´Ê¹Ò»¸öMySQLÀÏÊÖÓÐʱҲ»áΪ¸ÃÈí¼þ³öÆä²»ÒâµÄ¹¦ÄܸÐ̾¡£±¾ÎĽ«ÎªÄã½éÉÜÕâЩ²»ÎªÈËÖªµÄÌØÐÔ¡£
ÒÔXML¸ñʽ²é¿´²éѯ½á¹û
ͨ¹ýʹÓô«Í³—xml
Ñ¡Ïîµ÷ÓÃMySQLÃüÁîÐпͻ§³ÌÐò£¬Äã¿ÉÒÔÒÔXML¸ñʽ(¶ø²»ÊÇ´«Í³µÄÁбíÐÎʽ)À´²é¿´M ......

mysqlµ¥»ú¶àʵÀýÔËÐÐʵ¼ù(1)

1.install mysql
get mysql
http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# tar -zxvf mysql-5.1.41-linux-i686-icc-glibc23.tar.gz
[root@localhost mysql]# cd mysql-5.1.41-linux-i686-icc-glibc23
[root@localhost mysql]# vim RE ......

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±íºÍ×Ö¶Î×¢Ê͵ÄsqlÓï¾ä

½ñÌìÕÒµ½ÁËÈ¡mysql±íºÍ×Ö¶Î×¢Ê͵ÄÓï¾ä
È¡×Ö¶Î×¢ÊÍ
SELECT COLUMN_NAME ÁÐÃû, DATA_TYPE ×Ö¶ÎÀàÐÍ, COLUMN_COMMENT ×Ö¶Î×¢ÊÍ
from INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'companies'##±íÃû
AND table_schema = 'testhuicard'##Êý¾Ý¿âÃû
AND column_name LIKE 'c_name'##×Ö¶ÎÃû
--------------------------- ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ