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

ÈçºÎÈÃmysqlÖ§³ÖÖÐÎÄgbk×Ö·û¼¯

ÔÚmysqlÊý¾Ý¿âÖУ¬Ê¹ÓõÄÊÇlatin×Ö·û¼¯£¬ËùÒÔÎÞ·¨Õý³£µÄÖ§³ÖÖÐÎÄ×Ö·û£¬ÖÐÎÄÔÚÊý¾Ý¿âÖÐÏÔʾΪÂÒÂë“£¿”ºÅ¡£ÎªÁËÈÃmysql¿ÉÒÔÕý³£Ê¹ÓÃÖÐÎÄ£¬ÓÈÆäÊǵ±Ê¹ÓÃjspÁ¬½ÓmysqlµÄʱºò£¬ÎÒÃÇÐèҪʹÓÃgbkµÄ×Ö·û¼¯£¬Òò´ËÎÒÃÇÒª¶Ômysql½øÐÐÒÔÏÂÉèÖã¬ÒÔ±ãÆäÓÐЧµÄÖ§³ÖÖÐÎÄ£º
IXDBA.NET¼¼ÊõÉçÇø
1.ÐÞ¸Ämy.cnfÎļþ
my.cnfÎļþÊÇmysqlµÄÅäÖÃÎļþ£¬ÎÒÃÇ¿ÉÒÔ´ÓmysqlµÄ°²×°Ä¿Â¼¸ù¾ÝÆä×Ô´øÄ£°åÀ´
½¨Á¢
#cp /usr/local/mysql/support-files/my-huge.cnf  /etc/my.cnf
#vi /etc/my.cnf
ÔÚ´ËÎļþÖÐÏàӦλÖüÓÈë
default-character-set = gbk
########################
[client]
default-character-set = gbk
[mysqld]
default-character-set = gbk
#########################
Ð޸ĽáÊøÒԺ󣬱£´æ£¬È»ºóʹÓÿͻ§¶ËµÇ¼
#mysql -u root -p
ÔÚ¿Í»§¶ËÖÐÊäÈë
>status;
ÏÔʾµÄÊý¾ÝÖÐÈç¹û³öÏÖ£º
Server characterset:    gbk
Db     characterset:    gbk
Client characterset:    gbk
Conn.  characterset:    gbk
Ôò±íʾÐ޸ijɹ¦¡£
2.½¨Á¢¿â±íʱָ¶¨gbk×Ö·û¼¯
ÔÚ½¨Á¢¿â±íµÄʱºòÎÒÃÇÐèÒªÖ¸¶¨gbk×Ö·û¼¯
½¨Á¢Êý¾Ý¿â£º
CREATE DATABASE dbname DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci
½¨Á¢Êý¾Ý±í
Create table tablename(
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(15) NOT NULL default '',
PRIMARY KEY  (id)
) TYPE=MyISAM DEFAULT CHARACTER SET gbk
½¨Á¢ºÃÒÔºó£¬ÔÚ¿Í»§¶ËÖÐʹÓãº
>show cereate table tablename;
Èç¹û×îºóÒ»ÐÐÏÔʾgbk£¬Ôò±íʾ³É¹¦
3.ÐÞ¸ÄjdbcÇý¶¯
jspÁ¬½ÓmysqlÐèҪʹÓÃjdbcÇý¶¯£¬ÔÚʹÓõÄʱºò£¬ÎÒÃÇÐèÒªÉèÖúÃ×Ö·û¼¯
String user="root";
String password="123";
String url="jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=gbk"
Class.forNname("com.mysql.jdbc.Driver");//×°ÔØÇý¶¯Àࣻ
Connection con=DriverManager.getConnection(url,user,password);//È¡µÃÁ¬½Ó
ÆäÖÐdbnameΪÄãÊý¾Ý¿âµÄÃû×Ö£¬urlÖеÄgbk¼´ÎªÊ¹ÓõÄ×Ö·û¼¯
   ×öºÃÒÔÉÏÈý²½ÒÔºó£¬mysql¾Í¿ÉÒÔÖ§³ÖgbkÖÐÎÄÁË¡£


Ïà¹ØÎĵµ£º

Struts2+Spring+HibernateÁ¬½ÓmysqlÖÐÎÄÂÒÂë½â¾ö

1.struts.xmlÖÐÉèÖÃ
<constant name="struts.il8n.encoding" value="UTF-8"></constant>
2.jspÒ³ÃæÉèÖÃ
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
3.Êý¾Ý¿âÁ¬½Óurl
jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=u ......

Mysql Innodb ÒýÇæÓÅ»¯(


²ÎÊýƪ
×÷/ÒëÕߣºÎâ±þÎý£¬À´Ô´£ºhttp://imysql.cn¡¡£¦¡¡http://imysql.cn/blog/3208¡¡×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
 
½éÉÜ£º
¡¡¡¡InnoDB¸øMySQLÌṩÁ˾ßÓÐÌá½»£¬»Ø¹öºÍ±ÀÀ£»Ö¸´ÄÜÁ¦µÄÊÂÎñ°²È«£¨ACID¼æÈÝ£©´æ´¢ÒýÇæ¡£InnoDBËø¶¨ÔÚÐм¶²¢ÇÒÒ²ÔÚSELECTÓï¾äÌṩһ¸öOracle·ç¸ñÒ»Ö ......

ÈçºÎÌá¸ßMysqlÓï¾ä²åÈëÐÔÄÜ

ÔÚ±íÖÐÒÑÓдóÁ¿µÄindexµÄÇé¿öϲåÈë´óÁ¿Êý¾Ý£¬¿ÉÒÔ²ÉÓÃÏȽ«Ë÷Òýɾ³ý£¬È»ºóÔÙ²åÈëÊý¾Ý£¬È»ºóÔÙÖØн¨Á¢Ë÷Òý¡£Ö®ËùÒÔÕâÑù»á¿ìÊÇÒòΪ£¿£¿£¿
7.2.14 Speed of INSERT Statements
The time to insert a record is determined by the following factors, where the numbers indicate approximate proportions:
  & ......

MySQL Êý¾Ý¿â³£ÓÃÃüÁî

1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......

mysql´æÖü¹ý³Ì

## **********first test,procedure**********
#<1>
use testprocedure;
delimiter //
create procedure simpleproce1 (out par1 int)
begin
 select count(*) into par1 from proce;
end
//
delimiter ;
call simpleproce1(@a);
select @a;
#<2>,ÿ´ÎÖ»Óе¥Ò»µÄÐпÉÒÔ±»È¡»Øselect id,name i ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ