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

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Ë÷ÒýÓÅ»¯

ÔÚһЩÇé¿öÏ£¬MySQL¿ÉÒÔÖ±½ÓʹÓÃË÷ÒýÀ´Âú×ãÒ»¸ö ORDER BY »ò GROUP BY ×Ó¾ä¶øÎÞÐè×ö¶îÍâµÄÅÅÐò¡£¾¡¹Ü ORDER BY ²»ÊǺÍË÷ÒýµÄ˳Ðò׼ȷƥÅ䣬Ë÷Òý»¹ÊÇ¿ÉÒÔ±»Óõ½£¬Ö»Òª²»ÓõÄË÷Òý²¿·ÖºÍËùÓеĶîÍâµÄ ORDER BY ×Ö¶ÎÔÚ WHERE ×Ó¾äÖж¼±»°üÀ¨ÁË¡£ ¡¡¡¡Ê¹ÓÃË÷ÒýµÄMySQL Order By ¡¡¡¡ÏÂÁеļ¸¸ö²éѯ¶¼»áʹÓÃË÷ÒýÀ´½â¾ö ORDER BY ......

ʵÏÖwin2003ÏÂmysqlÊý¾Ý¿âÿÌì×Ô¶¯±¸·Ý

ÖÕÓÚÈ÷þÎñÆ÷ÿÌìÔçÉϱ¸·ÝÒ»´Î MySQL Êý¾Ý¿â²¢×Ô¶¯´ò°ü,ͬʱɾ³ý 5 ÌìÇ°µÄ±¸·ÝÎļþ. ·ÖÏíÈçÏÂ.
1. »·¾³: windows server 2003 + Apache 2.0 + PHP5 + MySQL 4.0.26 .
2. ¼ÙÉè PHP °²×°Ä¿Â¼Îª D:/php ,MySQL °²×°Ä¿Â¼Îª D:/mysql.
3. ÔÚ D:/php Ͻ¨Á¢Ä¿Â¼ WinRAR, °ÑÄã winrar °²×°Ä¿Â¼Ï嵀 WinRAR.exe ºÍ RARReg.KEY ¸´ ......

ubuntu mysqlµÄ°²×°

sudo apt-get install mysql-server
Õâ¸öÓ¦¸ÃºÜ¼òµ¥ÁË£¬¶øÇÒÎÒ¾õµÃ´ó¼ÒÔÚ°²×°·½ÃæҲûʲô̫´óÎÊÌ⣬ËùÒÔÒ²¾Í²»¶à˵ÁË£¬ÏÂÃæÎÒÃÇÀ´½²½²ÅäÖá£
ÅäÖÃMySQL
×¢Ò⣬ÔÚUbuntuÏÂMySQLȱʡÊÇÖ»ÔÊÐí±¾µØ·ÃÎʵģ¬Èç¹ûÄãÒªÆäËû»úÆ÷Ò²Äܹ»·ÃÎʵĻ°£¬ÄÇôÐèÒª¸Ä±ä/etc/mysql/my.cnfÅäÖÃÎļþÁË£¡ÏÂÃæÎÒÃÇÒ»²½²½µØÀ´£º
ĬÈϵÄMySQL°²× ......

VCÖÐÓÃADO²Ù×÷MySqlÊý¾Ý¿âÖÐÎÄÎÊÌâ

      ÎҵijÌÐòÊÇÓÃADOÀ´Á¬½ÓMysqÊý¾Ý¿âµÄ£¬ÕâÊÇÔ­ÏÈдºÃÓÃÔÚMSSQLÉϵģ¬¸ÄÁËÏÂÁ¬½Ó×Ö·û´®£¬ËùÒÔÒ²¾ÍûÓÐÓÃMySql C++ APIÀ´ÖØÐÂдÁË¡£¸Õ¿ªÊ¼Ê¹ÓÃMySql£¬Óöµ½µÄÎÊÌâ×ÜÊÇÌرðµÄ¶à£¬ÏÖÔÚÓÖÓöµ½Ò»¸öÖ÷Òªsql×Ö·û´®ÖÐÓÐÖÐÎľͱ¨´íµÄÎÊÌ⣬ûÓÐÖÐÎÄÒ»ÇÐÕý³££¬ÕûÕûŪÁËÒ»¸öÉÏÎ磬ÔÚÍøÉÏÒ²ÕÒÁ˺ܶà×ÊÁÏ£¬·¢ ......

mysql distinct ¶Ô¶à×ֶιýÂ˲»ÕýÈ·µÄ½â¾ö·½·¨


ÏÂÃæÏÈÀ´¿´¿´Àý×Ó£º
    table
  id name
  1 a
  2 b
  3 c
  4 c
  5 b
¿â½á¹¹´ó¸ÅÕâÑù£¬ÕâÖ»ÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£¬Êµ¼ÊÇé¿ö»á¸´Ôӵöࡣ
±ÈÈçÎÒÏëÓÃÒ»ÌõÓï¾ä²éѯµÃµ½name²»Öظ´µÄËùÓÐÊý¾Ý£¬ÄǾͱØÐëʹÓÃdistinctÈ¥µô¶àÓàµÄÖظ´¼Ç¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ