mysql±àÂëÉèÖÃ
mysql
> SHOW VARIABLES LIKE
'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection |
latin1 |
| character_set_database | latin1 |
|
character_set_results | latin1 |
| character_set_server | latin1 |
|
character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql
/charsets/
|
+--------------------------+----------------------------+
7
rows in set (0.00 sec)
mysql
>
SHOW VARIABLES LIKE 'collation_%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
|
collation_database | latin1_swedish_ci |
| collation_server |
latin1_swedish_ci |
+----------------------+-------------------+
3
rows in set (0.00 sec)
ĬÈϾÍÊÇÈðµälatin1,Ò»ÏÂÊÇ»»³ÉÎÒÃÇ×Ô¼ºµÄ±àÂ룬Èçutf8:
Íâ
²¿·ÃÎÊÊý¾ÝÂÒÂëµÄÎÊÌâ¾Í³öÔÚÕâ¸öconnectionÁ¬½Ó²ãÉÏ,½â¾ö·½·¨ÊÇÔÚ·¢ËͲéѯǰִÐÐÒ»ÏÂÏÂÃæÕâ¾ä£º
1.
SET NAMES 'utf8';
ËüÏ൱ÓÚÏÂÃæµÄÈý¾äÖ¸Á
SET character_set_client =
utf8;
SET character_set_results = utf8;
SET
character_set_connection = utf8;
Ò»°ãÖ»ÓÐÔÚ·ÃÎÊ֮ǰִÐÐÕâ¸ö´úÂë¾Í½â
¾öÎÊÌâÁË£¬ÏÂÃæÊÇ´´½¨Êý¾Ý¿âºÍÊý¾Ý±íµÄ£¬ÉèÖÃΪÎÒÃÇ×Ô¼ºµÄ±àÂë¸ñʽ¡£
2. ´´½¨Êý¾Ý¿â
mysql
> create database
name character set utf8;
3.
´´½¨±í
CREATE TABLE `type` (
`id`
int(10) unsigned NOT NULL auto_increment,
`flag_deleted`
enum('Y','N') character set utf8 NOT NULL default 'N',
`flag_type`
int(5) NOT NULL default '0',
`type_name` varchar(50) character set
utf8 NOT NULL default '',
PRIMARY KEY (`id`)
) DEFAULT
CHARSET=utf8;
4.
ÐÞ¸ÄÊý¾Ý¿â³Éutf8µÄ.
mysql
> alter database
name character set utf8;
5.
Ð޸ıíĬÈÏÓÃ
utf8.
mysql
>
alter table type character set utf8;
6.
ÐÞ¸Ä×Ö¶ÎÓÃutf8
mysql
>
alter table type
Ïà¹ØÎĵµ£º
ÔÚһЩÇé¿öÏ£¬MySQL¿ÉÒÔÖ±½ÓʹÓÃË÷ÒýÀ´Âú×ãÒ»¸ö ORDER BY »ò GROUP BY ×Ó¾ä¶øÎÞÐè×ö¶îÍâµÄÅÅÐò¡£¾¡¹Ü ORDER BY ²»ÊǺÍË÷ÒýµÄ˳Ðò׼ȷƥÅ䣬Ë÷Òý»¹ÊÇ¿ÉÒÔ±»Óõ½£¬Ö»Òª²»ÓõÄË÷Òý²¿·ÖºÍËùÓеĶîÍâµÄ ORDER BY ×Ö¶ÎÔÚ WHERE ×Ó¾äÖж¼±»°üÀ¨ÁË¡£ ¡¡¡¡Ê¹ÓÃË÷ÒýµÄMySQL Order By ¡¡¡¡ÏÂÁеļ¸¸ö²éѯ¶¼»áʹÓÃË÷ÒýÀ´½â¾ö ORDER BY ......
Èç¹ûÒªÁ˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ£¬Ê×ÏÈÁ˽âÒ»ÏÂMySQLµÄÈýÖÖËø¶¨ÀàÐÍ£º
Ò»£¬Ðм¶Ëø¶¨
¶þ£¬±í¼¶Ëø¶¨
Èý£¬Ò³¼¶Ëø¶¨
ÕâÈýÖÖËø¶¨ÀàÐÍ£¬ÔÚMySQLÊý¾Ý¿âÖÐʹÓÃÈçÏ£º
Ðм¶Ëø¶¨£ºMyISAM£¬Memory£¬CSV[·ÇÊÂÎñÐԵĴ洢ÒýÇæ]
±í¼¶Ëø¶¨£ºInnoDB£¬NDB Chuster
Ò³¼¶Ëø¶¨£ºBerkeley DB
Á½ÖÖËø¶¨»úÖÆ£º¶ÁËø¶¨ºÍдËø¶¨
MySQLÊý¾Ý¿âËø¶ ......
windows주
½â¾ö°ì·¨£º
1.¼ì²éÄãµÄMysqlĿ¼ÓÐûÓиøϵͳµÄSystemÓû§È¨ÏÞ¡£
2.ɾ³ýµôÄãµÄ %WINDOWS%/my.ini Îļþ¡£
3.¼ì²éÄãµÄ c:/my.cnf ÎļþÅäÖÃÊÇ·ñÕýÈ·¡£
ÐÞ¸Ä%windir%\my.ini£¬Ôö¼Ó
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=D:\Program\Tools\mysql
datadir=D:\Program\Tools\mysql\data& ......
1¡¢¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý
2¡¢É¾³ýMySQLÎļþ¼ÐϵÄmy.iniÎļþ£¬Èç¹û±¸·ÝºÃ£¬¿ÉÒÔÖ±½Ó½«Îļþ¼ÐÈ«²¿É¾³ý
3¡¢¿ªÊ¼->ÔËÐÐ-> regedit ¿´¿´×¢²á±íÀïÕ⼸¸öµØ·½É¾³ýûÓÐ
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL Ŀ¼ɾ³ý
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\S ......