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

Mysql UTF8 ½â¾öÂÒÂë

1£¬ÉèÖÃmysqlĬÈϱàÂë
Ê×ÏȲéѯһÏÂshow variables like 'character%'; 
È·¶¨ËùÓеÄcharacter¶¼ÉèÖóÉutf-8  
²Î¿¼ http://www.diybl.com/course/7_databases/mysql/myxl/20081127/152726.html
mysql>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
2£¬
a) ÉèÖÃwebÈÝÆ÷µÄ±àÂë¸ñʽ¡£ÎªÄãµÄservletµÄdoGet»òdoPost·½·¨¿ªÊ¼´¦¼ÓÈëÈçÏ´úÂ룺
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
b) Ϊÿ¸öjspÒ³ÃæÖ¸¶¨Æä±àÂë¸ñʽ¡£<%@ page pageEncoding="utf-8"%>
c) ÔÚÁ¬½ÓÊý¾Ý¿âÓõÄURLºó¼ÓÈ룺useUnicode=true;characterEncoding=utf-8¡¡È磺
¡¡¡¡                      url="jdbc:mysql:///db1?useUnicode=true&characterEncoding=utf-8"£¬
Èç¹ûÊÇxmlÎļþÖР    url="jdbc:mysql:///db1?useUnicode=true&amp;characterEncoding=utf-8"£¬
3, 
Èç¹û»¹³öÏÖÂÒÂ룬ÔòÓпÉÄÜÊÇ ±íÖеÄ×ֶΠµÄ±àÂë²»ÊÇutf-8;
Èç¹û³öÏÖÂÒÂëµÄ±íÊÇ book
mysql> show create table book;
+--------------------------+----------------------------+ 
 | Table | Create Table|
+--------------------------+----------------------------+
|book | create table 'book'(
     'id'  int(10) unsigned NOT NULL AUTO_INCREMENT,
     'bookname'  varchar(45)  CHARACTER SET latin1 NOT NULL,
     'source'  varc


Ïà¹ØÎĵµ£º

ÔÚmysqlÊý¾Ý¿âÖÐÈÕÆÚÓëlongÐ͵Äת»¯

1¡¢ÔÚmysql Êý¾Ý¿âÖУ¬“2009-09-15 00£º00£º00”ת»¯ÎªÁÐΪ³¤ÕûÐ͵ĺ¯Êý£º
select unix_timstamp("2009-09-15 00£º00£º00")*1000,
ÕâÀïҪעÒ⣬mysqlÊý¾Ý¿âÖеij¤ÕûÐÍ£¬±ÈjavaÖеij¤ÕûÐÍÉÙÁËÃëºóÃæµÄºÁÃëÊý£¬ËùÒÔÒª³ËÒÔ1000£¬ÕâÑùÖ»Óм¸ºÁÃëÖ®²î
2¡¢ÔÚmysqlÊý¾Ý¿âÖУ¬“1252999488000”£ ......

Javaµ÷Óô洢¹ý³Ì(MySqlÊý¾Ý¿â)

Ò»¡¢½¨±í
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `ID` int(11) NOT NULL auto_increment,
  `NAME` varchar(16) NOT NULL default '',
  `REMARK` varchar(16) NOT NULL default '',
  PRIMARY KEY  (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
&nb ......

ÈçºÎÐÞ¸ÄMySQL rootÃÜÂë

Íü¼ÇMySQL ROOTÃÜÂëÊÇÔÚMySQLʹÓÃÖкܳ£¼ûµÄÎÊÌ⣬¿ÉÊÇÓкܶàÅóÓѲ¢²»»áÖØÖÃROOTÃÜÂ룬Äǽпడ£¬ÎÒÓÐÉîÓид¥£¬ÌØд´ËÎÄÕÂÓë´ó¼Ò½»Á÷£º
 
1¡¢±à¼­MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini
//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf ......

ÓÃMySQL Éú³ÉËæ»úÃÜÂë

ÍíÉÏÓÐÅóÓÑÎÊÆ𣬼òµ¥µÄдÁËÒ»¸ö¡£
DELIMITER $$
CREATE
    FUNCTION `t_girl`
.
`func_rand_string`
(
f_num tinyint
unsigned
,
f_type tinyint
unsigned
)
    RETURNS varchar
(
32)
    BEGIN
       ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ