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

MYSQL ×Ö·û¼¯ÎÊÌâ

 
 
 
MySQLµÄ×Ö·û¼¯Ö§³Ö(Character Set Support)ÓÐÁ½¸ö·½Ã棺
     ×Ö·û¼¯(Character set)ºÍÅÅÐò·½Ê½(Collation)¡£
¶ÔÓÚ×Ö·û¼¯µÄÖ§³Öϸ»¯µ½Ëĸö²ã´Î:
     ·þÎñÆ÷(server)£¬Êý¾Ý¿â(database)£¬Êý¾Ý±í(table)ºÍÁ¬½Ó(connection)¡£
1.MySQLĬÈÏ×Ö·û¼¯
 
MySQL¶ÔÓÚ×Ö·û¼¯µÄÖ¸¶¨¿ÉÒÔϸ»¯µ½Ò»¸öÊý¾Ý¿â£¬Ò»ÕÅ±í£¬Ò»ÁУ¬Ó¦¸ÃÓÃʲô×Ö·û¼¯¡£
µ«ÊÇ£¬´«Í³µÄ³ÌÐòÔÚ´´½¨Êý¾Ý¿âºÍÊý¾Ý±íʱ²¢Ã»ÓÐʹÓÃÄÇô¸´ÔÓµÄÅäÖã¬ËüÃÇÓõÄÊÇĬÈϵÄÅäÖã¬ÄÇô£¬Ä¬ÈϵÄÅäÖôӺζøÀ´ÄØ£¿   
   (1)±àÒëMySQL ʱ£¬Ö¸¶¨ÁËÒ»¸öĬÈϵÄ×Ö·û¼¯£¬Õâ¸ö×Ö·û¼¯ÊÇ latin1£»
    (2)°²×°MySQL ʱ£¬¿ÉÒÔÔÚÅäÖÃÎļþ (my.ini) ÖÐÖ¸¶¨Ò»¸öĬÈϵĵÄ×Ö·û¼¯£¬Èç¹ûûָ¶¨£¬Õâ¸öÖµ¼Ì³Ð×Ô±àÒëʱָ¶¨µÄ£»
    (3)Æô¶¯mysqld ʱ£¬¿ÉÒÔÔÚÃüÁîÐвÎÊýÖÐÖ¸¶¨Ò»¸öĬÈϵĵÄ×Ö·û¼¯£¬Èç¹ûûָ¶¨£¬Õâ¸öÖµ¼Ì³Ð×ÔÅäÖÃÎļþÖеÄÅäÖÃ,´Ëʱ character_set_server ±»É趨ΪÕâ¸öĬÈϵÄ×Ö·û¼¯£»
    (4)µ±´´½¨Ò»¸öеÄÊý¾Ý¿âʱ£¬³ý·ÇÃ÷È·Ö¸¶¨£¬Õâ¸öÊý¾Ý¿âµÄ×Ö·û¼¯±»È±Ê¡É趨Ϊcharacter_set_server£»
    (5)µ±Ñ¡¶¨ÁËÒ»¸öÊý¾Ý¿âʱ£¬character_set_database ±»É趨ΪÕâ¸öÊý¾Ý¿âĬÈϵÄ×Ö·û¼¯£»
    (6)ÔÚÕâ¸öÊý¾Ý¿âÀï´´½¨Ò»Õűíʱ£¬±íĬÈϵÄ×Ö·û¼¯±»É趨Ϊ
    character_set_database£¬Ò²¾ÍÊÇÕâ¸öÊý¾Ý¿âĬÈϵÄ×Ö·û¼¯£»
    (7)µ±ÔÚ±íÄÚÉèÖÃÒ»À¸Ê±£¬³ý·ÇÃ÷È·Ö¸¶¨£¬·ñÔò´ËÀ¸È±Ê¡µÄ×Ö·û¼¯¾ÍÊDZíĬÈϵÄ×Ö·û¼¯£»
¼òµ¥µÄ×ܽáһϣ¬Èç¹ûʲôµØ·½¶¼²»Ð޸ģ¬ÄÇôËùÓеÄÊý¾Ý¿âµÄËùÓбíµÄËùÓÐÀ¸Î»µÄ¶¼Óà latin1 ´æ´¢£¬²»¹ýÎÒÃÇÈç¹û°²×° MySQL£¬Ò»°ã¶¼»áÑ¡Ôñ¶àÓïÑÔÖ§³Ö£¬Ò²¾ÍÊÇ˵£¬°²×°³ÌÐò»á×Ô¶¯ÔÚÅäÖÃÎļþÖÐ°Ñ default_character_set ÉèÖÃΪ UTF-8£¬Õâ±£Ö¤ÁËȱʡÇé¿öÏ£¬ËùÓеÄÊý¾Ý¿âµÄËùÓбíµÄËùÓÐÀ¸Î»µÄ¶¼Óà UTF-8 ´æ´¢¡£
2.²é¿´Ä¬ÈÏ×Ö·û¼¯(ĬÈÏÇé¿öÏ£¬mysqlµÄ×Ö·û¼¯ÊÇlatin1(ISO_8859_1)
ͨ³££¬²é¿´ÏµÍ³µÄ×Ö·û¼¯ºÍÅÅÐò·½Ê½µÄÉ趨¿ÉÒÔͨ¹ýÏÂÃæµÄÁ½ÌõÃüÁ
     mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+---------------------------------+
| Variable_name            | Value &nb


Ïà¹ØÎĵµ£º

MySQLѧϰ±Ê¼Ç

Ò»¡¢MySQL»ù±¾ÃüÁºÏ£º
1¡¢  create database mydata£»//´´½¨Êý¾Ý¿â
2¡¢  use mydata; //ÔÚmydataÕâ¸öÊý¾Ý¿âϹ¤×÷
3¡¢  create table dept    //ÔÚmydataÊý¾Ý¿âÏ´´½¨±ídept
(
deptno int primary key,
dname varchar(14),
loc varchar(13)
);
 
create table emp  / ......

mysql ¶¨Ê±Êý¾Ý±¸·Ý

1.±àдshell½Å±¾
vi /data/www/project_name/bin/mysql_backup.sh
#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by liuzheng

#ϵͳ±äÁ¿¶¨Òå
DBName=test
DBUser=root
DBPasswd=123456
BackupPath=/tmp/mysql_backup/

NewFile="$BackupPath"db$(date +%y%m%d ......

MySQL ShowÃüÁîµÄʹÓÃ

show tables»òshow tables from database_name;
½âÊÍ£ºÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ
show databases;
½âÊÍ£ºÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ
show processlist;
½âÊÍ£ºÏÔʾϵͳÖÐÕýÔÚÔËÐеÄËùÓнø³Ì£¬Ò²¾ÍÊǵ±Ç°ÕýÔÚÖ´ÐеIJéѯ¡£´ó¶àÊýÓû§¿ÉÒԲ鿴
ËûÃÇ×Ô¼ºµÄ½ø³Ì£¬µ«ÊÇÈç¹ûËûÃÇÓµÓÐprocessȨÏÞ£¬¾Í¿ÉÒԲ鿴ËùÓÐÈ˵Ľø ......

ÈçºÎÓÅ»¯MysqlǧÍò¼¶¿ìËÙ·ÖÒ³,limitÓÅ»¯¿ìËÙ·ÖÒ³

MySQLÊý¾Ý¿âÓÅ»¯´¦ÀíʵÏÖǧÍò¼¶¿ìËÙ·ÖÒ³·ÖÎö£¬À´¿´Ï°ɡ£
Êý¾Ý±í collect ( id, title ,info ,vtype) ¾ÍÕâ4¸ö×ֶΣ¬ÆäÖÐ title Óö¨³¤£¬info ÓÃtext, id ÊÇÖð½¥£¬vtypeÊÇtinyint£¬vtypeÊÇË÷Òý¡£ÕâÊÇÒ»¸ö»ù±¾µÄÐÂÎÅϵͳµÄ¼òµ¥Ä£ÐÍ¡£ÏÖÔÚÍùÀïÃæÌî³äÊý¾Ý£¬Ìî³ä10ÍòƪÐÂÎÅ¡£
×îºócollect Ϊ 10ÍòÌõ¼Ç¼£¬Êý¾Ý¿â±íÕ¼ÓÃÓ²ÅÌ1.6G ......

PBÁ¬½ÓMYSQLÊý¾Ý¿â

È¥mysqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØodbc connector(http://dev.mysql.com/downloads/connector/odbc/3.51.html)
ÏÂÔصÄÊÇmysql-connector-odbc-noinstall-3.51.rar
½âѹºóÖ±½ÓÔËÐÐÎļþ¼ÐÖÐµÄ Install.bat Åú´¦ÀíÎļþ
mysql-connectorÓкü¸ÖÖ£¬Ñ¡ÔñÒ»¸ö×Ô¼ºÏ²»¶µÄ¼´¿É¡£
ÔÚxpÖдò¿ªODBCÊý¾ÝÔ´¹ÜÀíÆ÷£¨¿ØÖÆÃæ°å£­¡·¹ÜÀí¹¤¾ß£­¡·ODBCÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ