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

ÔÙ̸mysqlµÄÅäÖÃÎļþmy.ini or my.cnf (Ö®Ò»)

ÈçÈôתÔر¾ÎÄ£¬Çë×¢Ã÷ԭʼ³ö´¦£ºhttp://hi.baidu.com/hexiong/blog/item/e860e5dd9b0d3ae376c6381a.html
(hexiong@baidu or iihero@CSDN)
ż¶ûÅöµ½ÓÐÈËÎÊʹÓÃmysqlÃüÁîÐУ¬ÀÏÈÃÈËÊäÈë--default-character-set=gbkÖ®ÀàÎÞÁĵÄÑ¡ÏÈÃÈË·³¡£ÈÃÈ˶àÊäÈëÁ˼¸¸ö×Ö·û£¬È·ÊµÓе㲻¶Ô¾¢¡£
¼ÓÉÏÓÐʱºò×Ô¼ºÓÐʱºòDIY£¬ºÜÉÙÔÚwindowsÉÏʹÓð²×°µÄ°æ±¾£¬×ÜÊǽâѹËõ£¬È»ºó·ÅÒ»¸ömy.iniµ½½âѹËõĿ¼Ï±ߵÄijһ¸öÌØÊâµÄλÖá£ÕâÑù£¬mysqlÃüÁîÐУ¬È±Ê¡Çé¿öÏ£¬·´¶øload²»µ½Õâ¸öÅäÖÃÎļþÁË¡£
¹ØÓÚmy.iniÎļþµÄ¼ÓÔØ˳Ðò£¬Ïê¼û£ºhttp://hi.baidu.com/hexiong/blog/item/313534a8b7e0dcbdcb130cc5.html
ÒÔwindowsΪÀý£¬Ëü»áÕâÑù¼ÓÔØ£º
C:\WINDOWS\my.cnf¡¡C:\WINDOWS\my.ini¡¡C:\my.cnf ¡¡C:\my.ini
ÖÁÓÚ$installdir\my.ini£¬ºÙ, ²»ÊÇ°²×°°æ£¬Õâ¸ö±äÁ¿¹À¼ÆÊǶÁ²»µ½ÁË¡£
ÉÏÊöËĸöÎļþ£¬Ö»ÒªÇ°ÃæµÄijһ¸öÎļþ¼ÓÔسɹ¦£¬¾Í²»ÔÙ¼ÓÔغó±ßÖ¸¶¨µÄÅäÖÃÎļþÁË¡£
ËùÒÔ£¬ÒªÏëʹmysqlÃüÁîÐÐÖ±½ÓʹÓÃgbk×Ö·û¼¯£¬ÓÐÏÂÊö·½·¨£º
1. ÃüÁîÐУº
mysql -u test -p --default-character-set=gbk
2. ÃüÁîÐУº
mysql --defaults-file=<your real my.ini path> -u test -p
×¢Òâ --defaults-fileÓÀÔ¶Òª·Åµ½µÚÒ»¸ö²ÎÊýµÄλÖÃ
3. Ö±½ÓÖÆ×÷Ò»¸ö¿Í»§¶Ë°æ±¾µÄmy.ini£¬È磺
#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions
[client]
port        = 3306
default_character_set=gbk
°ÑËü´æµ½c:\my.ini
ÕâÀïÐèҪ˵Ã÷µÄÊÇ£º
Èç¹ûÄ㶨ÖƵÄmysqlÖÐmy.iniÎļþ±¾À´¾ÍÔÚÉϱß4¸ö·¾¶ÀïÍ·£¬Ö±½ÓÐÞ¸ÄÀï±ß[client]ϵÄdefault_character_setֵΪgbkºÃ¿É¡£·ñÔò¾Í¿ÉÒÔÉú³ÉÒ»¸öרΪclientʹÓõÄmy.ini
·½·¨3ËäÈ»·½±ã£¬µ«ÒòΪÊÇÈ«¾ÖÅäÖÃÎļþ£¬ËùÒÔÓÐʱºò²»Ãâ»áÏ໥ӰÏ죬ÓÈÆäÊÇһ̨»úÆ÷Óжà¸ömysql¡£
Õâ¸öʱºò£¬¿ÉÒÔʹÓÃÃüÁîÐУº
d:\>mysql -u test -p --default-character-set=latin1
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 5.0.9-beta-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like 'char%';
+--------------------------+-------------------------------------------+
| Variable_name      


Ïà¹ØÎĵµ£º

MysqlÎÊÌâ»ã×Ü

1£¬Mysql²åÈë¶þ½øÖÆ´ó¶ÔÏó³öÏÖÒì³££¬²åÈë¶þ½øÖƳöÏÖÒì³££¬Ôõô½â¾öcom.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
½â¾ö°ì·¨£ºurl=url=+"?useUnicode=true& ......

mysqlÁ¬½Ó²âÊÔ³ÌÐò

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%
//Á¬½ÓÊý¾Ý¿â
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection connection= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/dangyuan","root", ......

mysql ÖРʱ¼äºÍÈÕÆÚº¯Êý

»ù´¡²¿·Ö
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now()               |
+----------------- ......

mysql alter Óï¾äÓ÷¨,Ìí¼Ó¡¢Ð޸ġ¢É¾³ý×ֶεÈ

http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//Ö÷¼ü549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint n ......

mysql ÐÞ¸ÄÃÜÂë

use mysql
update user set Password=password('newpassword') where User='root';
flush privileges;
Ê×ÏÈÒªÉùÃ÷Ò»µã£¬´ó²¿·ÖÇé¿öÏ£¬ÐÞ¸ÄMySQLÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ģ¬
ËùÒÔÒ»°ãÓû§ÎÞ·¨¸ü¸ÄÃÜÂ룬³ý·ÇÇëÇó¹ÜÀíÔ±¡£
·½·¨Ò»
ʹÓÃphpmyadmin£¬ÕâÊÇ×î¼òµ¥µÄÁË£¬ÐÞ¸Ämysql¿âµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ