MysqlÖÐÎÄÂÒÂëÎÊÌâµÄС½á
¸ÅÊö£º
1.ÂÒÂëÎÊÌâ¹é¸ùµ½µ×ÊÇ×Ö·û¼¯µÄÎÊÌâ,ÄǾʹÓ×Ö·û¼¯ÉèÖ÷½Ã濼ÂÇ,²»ÍâºõÏÂÃ漸·½Ã棺
server(Mysql·þÎñÆ÷),client,database(Êý¾Ý¿â),connection(Á¬½Ó),result
MySQLµÄ×Ö·û¼¯´¦ÀíÊÇÕâÑùµÄ£º
£¨1£©·¢ËÍÇëÇó
¿Í»§¶Ë(character_set_client£©=¡·Êý¾Ý¿âÁ¬½Ó(character_set_connection)=¡·´æ´¢Êý¾Ý¿â(table,column)
£¨2£©·µ»ØÇëÇó
´æ´¢Êý¾Ý¿â(table,column)=¡·Êý¾Ý¿âÁ¬½Ó(character_set_connection )=¡·¿Í»§¶Ë(character_set_results)ÔÚÿһ¸ö·Ç³õʼ½Úµã£¬¶¼»á×öÒ»´Î´ÓÉÏÒ»¸ö½áµãµ½µ±Ç°½ÚµãµÄ×Ö·û¼¯×ª»»²Ù×÷¡£
2.MySQLÖÐĬÈÏ×Ö·û¼¯µÄÉèÖÃÓÐËļ¶:·þÎñÆ÷¼¶£¬Êý¾Ý¿â¼¶£¬±í¼¶£¬×ֶμ¶
ÉèÖò½Ö裺
1.ÐÞ¸ÄMysql·þÎñÆ÷µÄĬÈÏ×Ö·û±àÂ루Mysql°²×°Ä¿Â¼ÏµÄmy.iniÎļþ£©
CLIENT SECTIONÖÐÉèÖÃdefault-character-set=utf8
SERVER SECTIONÖÐÉèÖÃdefault-character-set=utf8
ÔÚMysqlÃüÁîÐÐÊäÈë\s,²é¿´Mysql·þÎñÆ÷ÐÅÏ¢£¬ÆäÖÐÓУº
Server characterset:utf8
Db characterset:utf8
Client characterset:utf8
Conn. characterset:utf8
ÉèÖóɹ¦¡£
2.н¨Êý¾Ý¿â¡¢±í¡¢×ֶζ¼»áʹÓÃĬÈϱàÂë
3.Ò³Ãæ±àÂë²ÉÓÃÓëÊý¾Ý¿âÏàͬ±àÂ루utf-8£©
ÕâÑù¾Í²»»á³öÏÖÂÒÂëµÄÇé¿öÁË¡£
4.Èç¹ûÊý¾Ý¿â±àÂëºÍÒ³Ãæ±àÂë²»Ò»ÖÂʱ£¬ÄÇôÔÚÁ¬½ÓÊý¾Ý¿âʱҪָ¶¨ÓëÒ³ÃæÒ»ÖµıàÂ뷽ʽ£¬ÓÐÁ½ÖÖ·½Ê½£º
mysql_set_charset(string charset,[link_identifier])£ºÊ×Ñ¡·½Ê½
mysql_query("SET NAMES 'charset'")£º²»ÍƼöʹÓÃ
mysql_set_charset() ±È mysql_query("SET NAMES 'XXX'")¶àÁËÒ»¸öÉèÖ㬾ÍÊÇ°Ñstruct MySQLµÄcharset³ÉÔ±Ò²ÉèÖÃÁË¡£Õâ¸ö³ÉÔ±±äÁ¿ÔÚescapeµÄʱºòÆðןÜÖØÒªµÄ×÷Óã¬ÌرðÊǶÔÓÚGBKÕâÖÖÔËÐаѓ”×÷Ϊ×Ö·ûÒ»²¿·ÖµÄ±àÂë¸ñʽ¡£Èç¹ûÄãֻʹÓÃmysql_query(”set names XXX”)£¬ÄÇôÔÚijЩ×Ö·û¼¯£¬»áÓÐÖØ´óµÄ°²È«Â©¶´£¬µ¼ÖÂmysql_real_escape_string±äµÃºÍaddslashesÒ»Ñù²»°²È«¡£
5.ÁíÍâҪעÒâµÄÊÇÒ³ÃæÎļþ±àÂ뷽ʽÓëÒ³ÃæÍ·²¿µÄmetaÐÅÏ¢ÖеÄcharsetÒ»¶¨Òª±£³ÖÒ»Ö£¬ÕâÊÇ×î»ù±¾µÄÉèÖá£
Ïà¹ØÎĵµ£º
¹Ù·½ÊÖ²áÉÏÊÇÕâôдµÄ£º
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{f ......
MySQL5.X¶¼ÒѾ·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵģ¬Æäʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾
Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃ棬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ
¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓë¼¼ÊõÎÞ¹ ......
1 MySQLÖ§³Öenum,ºÍsetÀàÐÍ£¬SQL Server²»Ö§³Ö
¡¡¡¡2 MySQL²»Ö§³Önchar,nvarchar,ntextÀàÐÍ
¡¡¡¡3 MySQLµÄµÝÔöÓï¾äÊÇAUTO_INCREMENT£¬¶øMS SQLÊÇidentity(1,1)
¡¡¡¡4 MS SQLĬÈϵ½´¦±í´´½¨Óï¾äµÄĬÈÏÖµ±íʾÊÇ((0)),¶øÔÚMySQLÀïÃæÊDz»ÔÊÐí´øÁ½À¨ºÅµÄ
¡¡¡¡5 MySQLÐèҪΪ±íÖ¸¶¨´æ´¢ÀàÐÍ
¡ ......
MySQL¿ÉÒÔΪ²»Í¬µÄÓû§·ÖÅäÑϸñµÄ¡¢¸´ÔÓµÄȨÏÞ¡£ÕâЩ²Ù×÷´ó¶à¶¼¿ÉÒÔÓÃSQLÖ¸ÁîGrant£¨·ÖÅäȨÏÞ£©ºÍRevoke£¨»ØÊÕȨÏÞ£©À´ÊµÏÖ¡£ Grant¿ÉÒÔ°ÑÖ¸¶¨µÄȨÏÞ·ÖÅä¸øÌض¨µÄÓû§£¬Èç¹ûÕâ¸öÓû§²»´æÔÚ£¬Ôò»á´´½¨Ò»¸öÓû§¡£
Grant ³£Óøñʽ:
grant ȨÏÞ1,ȨÏÞ2,…ȨÏÞn on Êý¾Ý¿âÃû³Æ.±íÃû³Æ to Óû§Ãû@Óû§µØÖ· ide ......